Delete rtc::Message and rtc::MessageHandler

Bug: webrtc:9702
Change-Id: I5b9a42264b2a84acce9096b21102233b4ed2f5ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276261
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38160}
diff --git a/p2p/base/connection.h b/p2p/base/connection.h
index bd17294..7baff02 100644
--- a/p2p/base/connection.h
+++ b/p2p/base/connection.h
@@ -26,7 +26,6 @@
 #include "p2p/base/stun_request.h"
 #include "p2p/base/transport_description.h"
 #include "rtc_base/async_packet_socket.h"
-#include "rtc_base/message_handler.h"
 #include "rtc_base/network.h"
 #include "rtc_base/numerics/event_based_exponential_moving_average.h"
 #include "rtc_base/rate_tracker.h"
diff --git a/pc/proxy.h b/pc/proxy.h
index a8eb6b2..2be115f 100644
--- a/pc/proxy.h
+++ b/pc/proxy.h
@@ -67,7 +67,6 @@
 #include "api/scoped_refptr.h"
 #include "api/task_queue/task_queue_base.h"
 #include "rtc_base/event.h"
-#include "rtc_base/message_handler.h"
 #include "rtc_base/string_utils.h"
 #include "rtc_base/system/rtc_export.h"
 #include "rtc_base/thread.h"
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 7dc32d3..665ee95 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -927,7 +927,6 @@
     "async_resolver.h",
     "internal/default_socket_server.cc",
     "internal/default_socket_server.h",
-    "message_handler.h",
     "network_monitor.cc",
     "network_monitor.h",
     "network_monitor_factory.cc",
@@ -936,7 +935,6 @@
     "physical_socket_server.h",
     "thread.cc",
     "thread.h",
-    "thread_message.h",
   ]
   absl_deps = [
     "//third_party/abseil-cpp/absl/algorithm:container",
diff --git a/rtc_base/message_handler.h b/rtc_base/message_handler.h
deleted file mode 100644
index 8c47e0ab..0000000
--- a/rtc_base/message_handler.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Copyright 2004 The WebRTC Project Authors. All rights reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef RTC_BASE_MESSAGE_HANDLER_H_
-#define RTC_BASE_MESSAGE_HANDLER_H_
-
-#include "rtc_base/system/rtc_export.h"
-
-namespace rtc {
-
-struct Message;
-
-// MessageQueue/Thread Messages get dispatched via the MessageHandler interface.
-class RTC_EXPORT MessageHandler {
- public:
-  virtual ~MessageHandler() {}
-  virtual void OnMessage(Message* msg) = 0;
-};
-
-}  // namespace rtc
-
-#endif  // RTC_BASE_MESSAGE_HANDLER_H_
diff --git a/rtc_base/rtc_certificate_generator.cc b/rtc_base/rtc_certificate_generator.cc
index bdd90f2..ffc51aa 100644
--- a/rtc_base/rtc_certificate_generator.cc
+++ b/rtc_base/rtc_certificate_generator.cc
@@ -17,7 +17,6 @@
 #include <utility>
 
 #include "rtc_base/checks.h"
-#include "rtc_base/message_handler.h"
 #include "rtc_base/ssl_identity.h"
 
 namespace rtc {
diff --git a/rtc_base/stream.h b/rtc_base/stream.h
index c0ceb4e..7a9a588 100644
--- a/rtc_base/stream.h
+++ b/rtc_base/stream.h
@@ -14,7 +14,6 @@
 #include <memory>
 
 #include "rtc_base/buffer.h"
-#include "rtc_base/message_handler.h"
 #include "rtc_base/system/rtc_export.h"
 #include "rtc_base/third_party/sigslot/sigslot.h"
 #include "rtc_base/thread.h"
diff --git a/rtc_base/thread_message.h b/rtc_base/thread_message.h
deleted file mode 100644
index dbde40b..0000000
--- a/rtc_base/thread_message.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-#ifndef RTC_BASE_THREAD_MESSAGE_H_
-#define RTC_BASE_THREAD_MESSAGE_H_
-
-#include <list>
-#include <memory>
-#include <utility>
-
-#include "api/scoped_refptr.h"
-#include "rtc_base/location.h"
-#include "rtc_base/message_handler.h"
-
-namespace rtc {
-
-// Derive from this for specialized data
-// App manages lifetime, except when messages are purged
-
-class MessageData {
- public:
-  MessageData() {}
-  virtual ~MessageData() {}
-};
-
-template <class T>
-class TypedMessageData : public MessageData {
- public:
-  explicit TypedMessageData(const T& data) : data_(data) {}
-  const T& data() const { return data_; }
-  T& data() { return data_; }
-
- private:
-  T data_;
-};
-
-// Like TypedMessageData, but for pointers that require a delete.
-template <class T>
-class ScopedMessageData : public MessageData {
- public:
-  explicit ScopedMessageData(std::unique_ptr<T> data)
-      : data_(std::move(data)) {}
-
-  const T& data() const { return *data_; }
-  T& data() { return *data_; }
-
-  T* Release() { return data_.release(); }
-
- private:
-  std::unique_ptr<T> data_;
-};
-
-// Like ScopedMessageData, but for reference counted pointers.
-template <class T>
-class ScopedRefMessageData : public MessageData {
- public:
-  explicit ScopedRefMessageData(T* data) : data_(data) {}
-  const scoped_refptr<T>& data() const { return data_; }
-  scoped_refptr<T>& data() { return data_; }
-
- private:
-  scoped_refptr<T> data_;
-};
-
-template <class T>
-inline MessageData* WrapMessageData(const T& data) {
-  return new TypedMessageData<T>(data);
-}
-
-template <class T>
-inline const T& UseMessageData(MessageData* data) {
-  return static_cast<TypedMessageData<T>*>(data)->data();
-}
-
-template <class T>
-class DisposeData : public MessageData {
- public:
-  explicit DisposeData(T* data) : data_(data) {}
-  virtual ~DisposeData() { delete data_; }
-
- private:
-  T* data_;
-};
-
-const uint32_t MQID_ANY = static_cast<uint32_t>(-1);
-
-// No destructor
-
-struct Message {
-  Message() : phandler(nullptr), message_id(0), pdata(nullptr) {}
-  inline bool Match(MessageHandler* handler, uint32_t id) const {
-    return (handler == nullptr || handler == phandler) &&
-           (id == MQID_ANY || id == message_id);
-  }
-  Location posted_from;
-  MessageHandler* phandler;
-  uint32_t message_id;
-  MessageData* pdata;
-};
-
-typedef std::list<Message> MessageList;
-}  // namespace rtc
-#endif  // RTC_BASE_THREAD_MESSAGE_H_
diff --git a/rtc_base/time_utils_unittest.cc b/rtc_base/time_utils_unittest.cc
index 2c73b0f..abd4466 100644
--- a/rtc_base/time_utils_unittest.cc
+++ b/rtc_base/time_utils_unittest.cc
@@ -16,7 +16,6 @@
 #include "rtc_base/event.h"
 #include "rtc_base/fake_clock.h"
 #include "rtc_base/helpers.h"
-#include "rtc_base/message_handler.h"
 #include "rtc_base/thread.h"
 #include "test/gtest.h"