Remove usage of rtc::MessageHandler in peer_connection example

Bug: webrtc:9702
Change-Id: I2d688461858d9b6f06a0f7928f3cff7c6a7b7db9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272080
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37813}
diff --git a/examples/peerconnection/client/peer_connection_client.h b/examples/peerconnection/client/peer_connection_client.h
index 00d2192..8f9c5b6 100644
--- a/examples/peerconnection/client/peer_connection_client.h
+++ b/examples/peerconnection/client/peer_connection_client.h
@@ -15,6 +15,7 @@
 #include <memory>
 #include <string>
 
+#include "api/task_queue/pending_task_safety_flag.h"
 #include "rtc_base/net_helpers.h"
 #include "rtc_base/physical_socket_server.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
@@ -34,8 +35,7 @@
   virtual ~PeerConnectionClientObserver() {}
 };
 
-class PeerConnectionClient : public sigslot::has_slots<>,
-                             public rtc::MessageHandler {
+class PeerConnectionClient : public sigslot::has_slots<> {
  public:
   enum State {
     NOT_CONNECTED,
@@ -65,9 +65,6 @@
 
   bool SignOut();
 
-  // implements the MessageHandler interface
-  void OnMessage(rtc::Message* msg);
-
  protected:
   void DoConnect();
   void Close();
@@ -126,6 +123,7 @@
   Peers peers_;
   State state_;
   int my_id_;
+  webrtc::ScopedTaskSafety safety_;
 };
 
 #endif  // EXAMPLES_PEERCONNECTION_CLIENT_PEER_CONNECTION_CLIENT_H_