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

Side by Side Diff: remoting/protocol/message_reader.h

Issue 10919259: Fix MessageReader not to invoke message callback from done callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/protocol/message_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_PROTOCOL_MESSAGE_READER_H_ 5 #ifndef REMOTING_PROTOCOL_MESSAGE_READER_H_
6 #define REMOTING_PROTOCOL_MESSAGE_READER_H_ 6 #define REMOTING_PROTOCOL_MESSAGE_READER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Initialize the MessageReader with a socket. If a message is received 44 // Initialize the MessageReader with a socket. If a message is received
45 // |callback| is called. 45 // |callback| is called.
46 void Init(net::Socket* socket, const MessageReceivedCallback& callback); 46 void Init(net::Socket* socket, const MessageReceivedCallback& callback);
47 47
48 private: 48 private:
49 void DoRead(); 49 void DoRead();
50 void OnRead(int result); 50 void OnRead(int result);
51 void HandleReadResult(int result); 51 void HandleReadResult(int result);
52 void OnDataReceived(net::IOBuffer* data, int data_size); 52 void OnDataReceived(net::IOBuffer* data, int data_size);
53 void RunCallback(scoped_ptr<CompoundBuffer> message);
53 void OnMessageDone(); 54 void OnMessageDone();
54 55
55 net::Socket* socket_; 56 net::Socket* socket_;
56 57
57 // Set to true, when we have a socket read pending, and expecting 58 // Set to true, when we have a socket read pending, and expecting
58 // OnRead() to be called when new data is received. 59 // OnRead() to be called when new data is received.
59 bool read_pending_; 60 bool read_pending_;
60 61
61 // Number of messages that we received, but haven't finished 62 // Number of messages that we received, but haven't finished
62 // processing yet, i.e. |done_task| hasn't been called for these 63 // processing yet, i.e. |done_task| hasn't been called for these
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 115 }
115 116
116 scoped_ptr<MessageReader> message_reader_; 117 scoped_ptr<MessageReader> message_reader_;
117 MessageReceivedCallback message_received_callback_; 118 MessageReceivedCallback message_received_callback_;
118 }; 119 };
119 120
120 } // namespace protocol 121 } // namespace protocol
121 } // namespace remoting 122 } // namespace remoting
122 123
123 #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_ 124 #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/message_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698