Use AsyncInvoker in DataChannel instead of MessageHandler
Bug: webrtc:9702
Change-Id: I76a6a97f792be632c1c2f4f5cbbd26a7ec243006
Reviewed-on: https://webrtc-review.googlesource.com/97183
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24517}
diff --git a/pc/datachannel.cc b/pc/datachannel.cc
index 6971ca8..f819d26 100644
--- a/pc/datachannel.cc
+++ b/pc/datachannel.cc
@@ -24,10 +24,6 @@
static size_t kMaxQueuedReceivedDataBytes = 16 * 1024 * 1024;
static size_t kMaxQueuedSendDataBytes = 16 * 1024 * 1024;
-enum {
- MSG_CHANNELREADY,
-};
-
bool SctpSidAllocator::AllocateSid(rtc::SSLRole role, int* sid) {
int potential_sid = (role == rtc::SSL_CLIENT) ? 0 : 1;
while (!IsSidAvailable(potential_sid)) {
@@ -187,7 +183,8 @@
// Chrome glue and WebKit) are not wired up properly until after this
// function returns.
if (provider_->ReadyToSendData()) {
- rtc::Thread::Current()->Post(RTC_FROM_HERE, this, MSG_CHANNELREADY, NULL);
+ invoker_.AsyncInvoke<void>(RTC_FROM_HERE, rtc::Thread::Current(),
+ [this] { OnChannelReady(true); });
}
}
@@ -346,14 +343,6 @@
UpdateState();
}
-void DataChannel::OnMessage(rtc::Message* msg) {
- switch (msg->message_id) {
- case MSG_CHANNELREADY:
- OnChannelReady(true);
- break;
- }
-}
-
void DataChannel::OnDataReceived(const cricket::ReceiveDataParams& params,
const rtc::CopyOnWriteBuffer& payload) {
if (data_channel_type_ == cricket::DCT_RTP && params.ssrc != receive_ssrc_) {