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.h b/pc/datachannel.h
index d29ee59..cbb0c8b 100644
--- a/pc/datachannel.h
+++ b/pc/datachannel.h
@@ -19,7 +19,7 @@
 #include "api/proxy.h"
 #include "media/base/mediachannel.h"
 #include "pc/channel.h"
-#include "rtc_base/messagehandler.h"
+#include "rtc_base/asyncinvoker.h"
 #include "rtc_base/scoped_ref_ptr.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
 
@@ -114,9 +114,7 @@
 // 5. Bob sends outgoing stream reset. 6. Alice receives incoming reset,
 //    Bob receives acknowledgement. Both receive OnClosingProcedureComplete
 //    callback and transition to kClosed.
-class DataChannel : public DataChannelInterface,
-                    public sigslot::has_slots<>,
-                    public rtc::MessageHandler {
+class DataChannel : public DataChannelInterface, public sigslot::has_slots<> {
  public:
   static rtc::scoped_refptr<DataChannel> Create(
       DataChannelProviderInterface* provider,
@@ -146,9 +144,6 @@
   virtual uint64_t bytes_received() const { return bytes_received_; }
   virtual bool Send(const DataBuffer& buffer);
 
-  // rtc::MessageHandler override.
-  virtual void OnMessage(rtc::Message* msg);
-
   // Called when the channel's ready to use.  That can happen when the
   // underlying DataMediaChannel becomes ready, or when this channel is a new
   // stream on an existing DataMediaChannel, and we've finished negotiation.
@@ -291,6 +286,7 @@
   PacketQueue queued_control_data_;
   PacketQueue queued_received_data_;
   PacketQueue queued_send_data_;
+  rtc::AsyncInvoker invoker_;
 };
 
 // Define proxy for DataChannelInterface.