Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_CLIENT_MESSAGE_DISPATCHER_H_ | |
| 6 #define REMOTING_PROTOCOL_CLIENT_MESSAGE_DISPATCHER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/scoped_ptr.h" | |
| 10 #include "base/task.h" | |
| 11 | |
| 12 namespace remoting { | |
| 13 | |
| 14 class EventMessage; | |
| 15 | |
| 16 namespace protocol { | |
| 17 | |
| 18 class ControlMessage; | |
| 19 class ClientStub; | |
| 20 class MessageReader; | |
|
awong
2010/12/23 01:15:10
sort
Alpha Left Google
2010/12/23 02:17:58
Done.
| |
| 21 class InputStub; | |
| 22 class Session; | |
| 23 | |
| 24 // A message dispatcher used to listen for messages received in | |
| 25 // protocol::Session. It dispatches messages to the corresponding | |
| 26 // handler. | |
| 27 // | |
| 28 // Internally it contains an EventStreamReader that decodes data on | |
| 29 // communications channels into protocol buffer messages. | |
| 30 // EventStreamReader is registered with protocol::Session given to it. | |
| 31 // | |
| 32 // Object of this class is owned by ConnectionToHost to dispatch messages | |
|
awong
2010/12/23 01:15:10
Drop the "to dispatch messages to itself."
This d
Alpha Left Google
2010/12/23 02:17:58
Done.
| |
| 33 // to itself. | |
| 34 class ClientMessageDispatcher { | |
| 35 public: | |
| 36 // Construct a message dispatcher. | |
| 37 ClientMessageDispatcher(); | |
| 38 virtual ~ClientMessageDispatcher(); | |
| 39 | |
| 40 // Initialize the message dispatcher with the given connection and | |
| 41 // message handlers. | |
| 42 // Return true if initalization was successful. | |
| 43 bool Initialize(protocol::Session* session, ClientStub* client_stub); | |
| 44 | |
| 45 private: | |
| 46 // This method is called by |control_channel_reader_| when a control | |
|
awong
2010/12/23 01:15:10
This comment says exactly what the function name s
Alpha Left Google
2010/12/23 02:17:58
Done.
| |
| 47 // message is received. | |
| 48 void OnControlMessageReceived(ControlMessage* message); | |
| 49 | |
| 50 // MessageReader that runs on the control channel. It runs a loop | |
| 51 // that parses data on the channel and then delegates the message to this | |
|
awong
2010/12/23 01:15:10
"then delegates the message to this class" -> "the
Alpha Left Google
2010/12/23 02:17:58
Done.
| |
| 52 // class. | |
| 53 scoped_ptr<MessageReader> control_message_reader_; | |
| 54 | |
| 55 // Stubs for client and input. These objects are not owned. | |
| 56 // They are called on the thread there data is received, i.e. jingle thread. | |
| 57 ClientStub* client_stub_; | |
|
awong
2010/12/23 01:15:10
DISALLOW_COPY_AND_ASSIGN?
Alpha Left Google
2010/12/23 02:17:58
Done.
| |
| 58 }; | |
| 59 | |
| 60 } // namespace protocol | |
| 61 } // namespace remoting | |
| 62 | |
| 63 #endif // REMOTING_PROTOCOL_CLIENT_MESSAGE_DISPATCHER_H_ | |
| OLD | NEW |