diff options
author | haibinlu <haibinlu@chromium.org> | 2015-11-17 15:39:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-17 23:41:20 +0000 |
commit | c19c3310aae2281ccabc6fce2e3565a7c4aff703 (patch) | |
tree | fde5b87c0b0bb4a164df090fe7a304e247dc4755 /blimp/net/blimp_connection.h | |
parent | 8bb621b0623b0eae3e53e04f4a68b3c6d08db0b7 (diff) | |
download | chromium_src-c19c3310aae2281ccabc6fce2e3565a7c4aff703.zip chromium_src-c19c3310aae2281ccabc6fce2e3565a7c4aff703.tar.gz chromium_src-c19c3310aae2281ccabc6fce2e3565a7c4aff703.tar.bz2 |
[Blimp]Add BlimpMessagePump to BlimpConnection.
It deserializes incoming messages and forwards it to a message processsor.
BUG= 556715
Review URL: https://codereview.chromium.org/1437003007
Cr-Commit-Position: refs/heads/master@{#360203}
Diffstat (limited to 'blimp/net/blimp_connection.h')
-rw-r--r-- | blimp/net/blimp_connection.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/blimp/net/blimp_connection.h b/blimp/net/blimp_connection.h index 38961e6..a48521a 100644 --- a/blimp/net/blimp_connection.h +++ b/blimp/net/blimp_connection.h @@ -12,6 +12,8 @@ namespace blimp { class BlimpMessageProcessor; +class BlimpMessagePump; +class ConnectionErrorObserver; class PacketReader; class PacketWriter; @@ -19,29 +21,25 @@ class PacketWriter; // a network connection. class BLIMP_NET_EXPORT BlimpConnection { public: - class DisconnectObserver { - // Called when the network connection for |this| is disconnected. - virtual void OnDisconnected() = 0; - }; - BlimpConnection(scoped_ptr<PacketReader> reader, scoped_ptr<PacketWriter> writer); virtual ~BlimpConnection(); - // Lets |observer| know when the network connection is terminated. - void AddDisconnectObserver(DisconnectObserver* observer); + // Lets |observer| know when the network connection encounters an error. + void SetConnectionErrorObserver(ConnectionErrorObserver* observer); // Sets the processor which will take incoming messages for this connection. // Can be set multiple times, but previously set processors are discarded. - void set_incoming_message_processor( - scoped_ptr<BlimpMessageProcessor> processor); + // Caller retains the ownership of |processor|. + void SetIncomingMessageProcessor(BlimpMessageProcessor* processor); // Gets a processor for BrowserSession->BlimpConnection message routing. scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const; private: scoped_ptr<PacketReader> reader_; + scoped_ptr<BlimpMessagePump> message_pump_; scoped_ptr<PacketWriter> writer_; DISALLOW_COPY_AND_ASSIGN(BlimpConnection); |