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

Unified Diff: blimp/net/blimp_message_pump.h

Issue 1452823011: Make PacketReader/PacketWriter interfaces async-only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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
« no previous file with comments | « blimp/net/blimp_connection_unittest.cc ('k') | blimp/net/blimp_message_pump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/blimp_message_pump.h
diff --git a/blimp/net/blimp_message_pump.h b/blimp/net/blimp_message_pump.h
index e8fc0aade5c19e2ecba00f2a55e3bae87d72c5ab..d86b7500d0dbc2fe5235df1f9cd7c39b06b84ac1 100644
--- a/blimp/net/blimp_message_pump.h
+++ b/blimp/net/blimp_message_pump.h
@@ -26,13 +26,12 @@ class PacketReader;
// message, the BlimpMessagePump reads the next packet.
class BLIMP_NET_EXPORT BlimpMessagePump {
public:
- // Caller ensures |reader| outlive this object.
+ // Caller ensures that |reader| outlives this object.
explicit BlimpMessagePump(PacketReader* reader);
~BlimpMessagePump();
- // Sets the processor which will take blimp messages.
- // Can be set multiple times, but previously set processors are discarded.
+ // Sets the processor which will take BlimpMessages. Can only be set once.
// Caller retains the ownership of |processor|.
void SetMessageProcessor(BlimpMessageProcessor* processor);
@@ -47,16 +46,22 @@ class BLIMP_NET_EXPORT BlimpMessagePump {
// Callback when next packet is ready in |buffer_|.
void OnReadPacketComplete(int result);
- // Callback when |processor_| finishes processing a blimp message.
+ // Callback when |processor_| finishes processing a BlimpMessage.
void OnProcessMessageComplete(int result);
PacketReader* reader_;
ConnectionErrorObserver* error_observer_;
BlimpMessageProcessor* processor_;
scoped_refptr<net::GrowableIOBuffer> buffer_;
- net::CancelableCompletionCallback read_packet_callback_;
+
+ // Cancelled in the event that the connection is destroyed (along with
+ // |this|) while a inflight callback is held by |processor_|.
net::CancelableCompletionCallback process_msg_callback_;
+ // Cancelled to guard against |this| being called back from a completed read
+ // operation.
+ net::CancelableCompletionCallback read_callback_;
+
DISALLOW_COPY_AND_ASSIGN(BlimpMessagePump);
};
« no previous file with comments | « blimp/net/blimp_connection_unittest.cc ('k') | blimp/net/blimp_message_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698