Remove MessageHandler[AutoCleanup] dependency from StreamInterface.

This includes relying on related types such as MessageData and
PostEvent functionality inside the StreamInterface itself.

This affects mostly tests but OpenSSLStreamAdapter
requires special attention.

Bug: webrtc:11988
Change-Id: Ib5c895f1bdf77bb49e3162bd49718f8a98812d91
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185505
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32290}
This commit is contained in:
Tomas Gunnarsson
2020-10-02 12:54:10 +02:00
committed by Commit Bot
parent b33a7186e6
commit eb79dd9ffd
9 changed files with 86 additions and 67 deletions

View File

@ -48,16 +48,9 @@ enum StreamResult { SR_ERROR, SR_SUCCESS, SR_BLOCK, SR_EOS };
// SE_WRITE: Data can be written, so Write is likely to not return SR_BLOCK
enum StreamEvent { SE_OPEN = 1, SE_READ = 2, SE_WRITE = 4, SE_CLOSE = 8 };
struct StreamEventData : public MessageData {
int events, error;
StreamEventData(int ev, int er) : events(ev), error(er) {}
};
class RTC_EXPORT StreamInterface : public MessageHandlerAutoCleanup {
class RTC_EXPORT StreamInterface {
public:
enum { MSG_POST_EVENT = 0xF1F1, MSG_MAX = MSG_POST_EVENT };
~StreamInterface() override;
virtual ~StreamInterface() {}
virtual StreamState GetState() const = 0;
@ -96,13 +89,6 @@ class RTC_EXPORT StreamInterface : public MessageHandlerAutoCleanup {
// certain events will be raised in the future.
sigslot::signal3<StreamInterface*, int, int> SignalEvent;
// Like calling SignalEvent, but posts a message to the specified thread,
// which will call SignalEvent. This helps unroll the stack and prevent
// re-entrancy.
void PostEvent(Thread* t, int events, int err);
// Like the aforementioned method, but posts to the current thread.
void PostEvent(int events, int err);
// Return true if flush is successful.
virtual bool Flush();
@ -125,9 +111,6 @@ class RTC_EXPORT StreamInterface : public MessageHandlerAutoCleanup {
protected:
StreamInterface();
// MessageHandler Interface
void OnMessage(Message* msg) override;
private:
RTC_DISALLOW_COPY_AND_ASSIGN(StreamInterface);
};