OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 private: | 52 private: |
53 void DoRead(); | 53 void DoRead(); |
54 void OnRead(int result); | 54 void OnRead(int result); |
55 void HandleReadResult(int result); | 55 void HandleReadResult(int result); |
56 void OnDataReceived(net::IOBuffer* data, int data_size); | 56 void OnDataReceived(net::IOBuffer* data, int data_size); |
57 void OnMessageDone(CompoundBuffer* message); | 57 void OnMessageDone(CompoundBuffer* message); |
58 void ProcessDoneEvent(); | 58 void ProcessDoneEvent(); |
59 | 59 |
60 net::Socket* socket_; | 60 net::Socket* socket_; |
61 | 61 |
62 // The network message loop this object runs on. | |
63 MessageLoop* message_loop_; | |
64 | |
65 // Set to true, when we have a socket read pending, and expecting | 62 // Set to true, when we have a socket read pending, and expecting |
66 // OnRead() to be called when new data is received. | 63 // OnRead() to be called when new data is received. |
67 bool read_pending_; | 64 bool read_pending_; |
68 | 65 |
69 // Number of messages that we received, but haven't finished | 66 // Number of messages that we received, but haven't finished |
70 // processing yet, i.e. |done_task| hasn't been called for these | 67 // processing yet, i.e. |done_task| hasn't been called for these |
71 // messages. | 68 // messages. |
72 int pending_messages_; | 69 int pending_messages_; |
73 | 70 |
74 bool closed_; | 71 bool closed_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 118 } |
122 | 119 |
123 scoped_refptr<MessageReader> message_reader_; | 120 scoped_refptr<MessageReader> message_reader_; |
124 scoped_ptr<MessageReceivedCallback> message_received_callback_; | 121 scoped_ptr<MessageReceivedCallback> message_received_callback_; |
125 }; | 122 }; |
126 | 123 |
127 } // namespace protocol | 124 } // namespace protocol |
128 } // namespace remoting | 125 } // namespace remoting |
129 | 126 |
130 #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_ | 127 #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_ |
OLD | NEW |