From cbad8add12f5a58ff7d538e5b8bc16b4b01b191c Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 21 Sep 2022 13:55:31 +0200 Subject: [PATCH] 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 Reviewed-by: Tomas Gunnarsson Cr-Commit-Position: refs/heads/main@{#38160} --- p2p/base/connection.h | 1 - pc/proxy.h | 1 - rtc_base/BUILD.gn | 2 - rtc_base/message_handler.h | 29 ------- rtc_base/rtc_certificate_generator.cc | 1 - rtc_base/stream.h | 1 - rtc_base/thread_message.h | 109 -------------------------- rtc_base/time_utils_unittest.cc | 1 - 8 files changed, 145 deletions(-) delete mode 100644 rtc_base/message_handler.h delete mode 100644 rtc_base/thread_message.h diff --git a/p2p/base/connection.h b/p2p/base/connection.h index bd172943cd..7baff0287c 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 a8eb6b21d4..2be115fdf3 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 7dc32d388f..665ee9502e 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -927,7 +927,6 @@ rtc_library("threading") { "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 @@ rtc_library("threading") { "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 8c47e0ab52..0000000000 --- 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 bdd90f209e..ffc51aa8da 100644 --- a/rtc_base/rtc_certificate_generator.cc +++ b/rtc_base/rtc_certificate_generator.cc @@ -17,7 +17,6 @@ #include #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 c0ceb4e36d..7a9a588733 100644 --- a/rtc_base/stream.h +++ b/rtc_base/stream.h @@ -14,7 +14,6 @@ #include #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 dbde40b0f0..0000000000 --- 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 -#include -#include - -#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 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 ScopedMessageData : public MessageData { - public: - explicit ScopedMessageData(std::unique_ptr data) - : data_(std::move(data)) {} - - const T& data() const { return *data_; } - T& data() { return *data_; } - - T* Release() { return data_.release(); } - - private: - std::unique_ptr data_; -}; - -// Like ScopedMessageData, but for reference counted pointers. -template -class ScopedRefMessageData : public MessageData { - public: - explicit ScopedRefMessageData(T* data) : data_(data) {} - const scoped_refptr& data() const { return data_; } - scoped_refptr& data() { return data_; } - - private: - scoped_refptr data_; -}; - -template -inline MessageData* WrapMessageData(const T& data) { - return new TypedMessageData(data); -} - -template -inline const T& UseMessageData(MessageData* data) { - return static_cast*>(data)->data(); -} - -template -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(-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 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 2c73b0f201..abd44660b2 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"