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}
This commit is contained in:
Danil Chapovalov
2022-09-21 13:55:31 +02:00
committed by WebRTC LUCI CQ
parent 65ab3460f5
commit cbad8add12
8 changed files with 0 additions and 145 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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",

View File

@ -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_

View File

@ -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 {

View File

@ -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"

View File

@ -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_

View File

@ -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"