Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1413)

Unified Diff: blimp/net/blimp_connection.h

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address wez's feedback. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/net/blimp_connection.h
diff --git a/blimp/net/blimp_connection.h b/blimp/net/blimp_connection.h
index 5bd115d6fe71c46c8d203bc2ad9590184c6e953c..8e3cf50bd5a7ea5c7dad8928aced6c6f981d9529 100644
--- a/blimp/net/blimp_connection.h
+++ b/blimp/net/blimp_connection.h
@@ -11,17 +11,36 @@
namespace blimp {
+class BlimpMessageProcessor;
class PacketReader;
class PacketWriter;
+
Wez 2015/11/12 03:45:56 nit: Remove spurious blank line.
Kevin M 2015/11/12 19:03:47 Done.
+// Encapsulates the state and logic used to exchange BlimpMessages over
+// a network connection.
class BLIMP_NET_EXPORT BlimpConnection {
public:
- virtual ~BlimpConnection();
+ class DisconnectObserver {
+ // Called when the network connection for |this| is disconnected.
+ virtual void OnDisconnected() = 0;
+ };
- protected:
BlimpConnection(scoped_ptr<PacketReader> reader,
scoped_ptr<PacketWriter> writer);
+ ~BlimpConnection();
+
+ // Lets |observer| know when the network connection is terminated.
+ void AddDisconnectObserver(DisconnectObserver* 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);
+
+ // Gets a processor for BrowserSession->BlimpConnection message routing.
+ scoped_ptr<BlimpMessageProcessor> take_outgoing_message_processor() const;
+
private:
scoped_ptr<PacketReader> reader_;
scoped_ptr<PacketWriter> writer_;

Powered by Google App Engine
This is Rietveld 408576698