OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_HOST_MESSAGE_DISPATCHER_H_ | 5 #ifndef REMOTING_PROTOCOL_HOST_MESSAGE_DISPATCHER_H_ |
6 #define REMOTING_PROTOCOL_HOST_MESSAGE_DISPATCHER_H_ | 6 #define REMOTING_PROTOCOL_HOST_MESSAGE_DISPATCHER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "remoting/protocol/message_reader.h" |
11 | 12 |
12 namespace remoting { | 13 namespace remoting { |
13 | 14 |
14 class EventMessage; | 15 class EventMessage; |
15 | 16 |
16 namespace protocol { | 17 namespace protocol { |
17 | 18 |
18 class ControlMessage; | 19 class ControlMessage; |
19 class HostStub; | 20 class HostStub; |
20 class MessageReader; | |
21 class InputStub; | 21 class InputStub; |
22 class Session; | 22 class Session; |
23 | 23 |
24 // A message dispatcher used to listen for messages received in | 24 // A message dispatcher used to listen for messages received in |
25 // protocol::Session. It dispatches messages to the corresponding | 25 // protocol::Session. It dispatches messages to the corresponding |
26 // handler. | 26 // handler. |
27 // | 27 // |
28 // Internally it contains an EventStreamReader that decodes data on | 28 // Internally it contains an EventStreamReader that decodes data on |
29 // communications channels into protocol buffer messages. | 29 // communications channels into protocol buffer messages. |
30 // EventStreamReader is registered with protocol::Session given to it. | 30 // EventStreamReader is registered with protocol::Session given to it. |
(...skipping 16 matching lines...) Expand all Loading... |
47 // message is received. | 47 // message is received. |
48 void OnControlMessageReceived(ControlMessage* message); | 48 void OnControlMessageReceived(ControlMessage* message); |
49 | 49 |
50 // This method is called by |event_channel_reader_| when a event | 50 // This method is called by |event_channel_reader_| when a event |
51 // message is received. | 51 // message is received. |
52 void OnEventMessageReceived(EventMessage* message); | 52 void OnEventMessageReceived(EventMessage* message); |
53 | 53 |
54 // MessageReader that runs on the control channel. It runs a loop | 54 // MessageReader that runs on the control channel. It runs a loop |
55 // that parses data on the channel and then delegates the message to this | 55 // that parses data on the channel and then delegates the message to this |
56 // class. | 56 // class. |
57 scoped_ptr<MessageReader> control_message_reader_; | 57 scoped_ptr<ProtobufMessageReader<ControlMessage> > control_message_reader_; |
58 | 58 |
59 // MessageReader that runs on the event channel. | 59 // MessageReader that runs on the event channel. |
60 scoped_ptr<MessageReader> event_message_reader_; | 60 scoped_ptr<ProtobufMessageReader<EventMessage> > event_message_reader_; |
61 | 61 |
62 // Stubs for host and input. These objects are not owned. | 62 // Stubs for host and input. These objects are not owned. |
63 // They are called on the thread there data is received, i.e. jingle thread. | 63 // They are called on the thread there data is received, i.e. jingle thread. |
64 HostStub* host_stub_; | 64 HostStub* host_stub_; |
65 InputStub* input_stub_; | 65 InputStub* input_stub_; |
66 }; | 66 }; |
67 | 67 |
68 } // namespace protocol | 68 } // namespace protocol |
69 } // namespace remoting | 69 } // namespace remoting |
70 | 70 |
71 #endif // REMOTING_PROTOCOL_HOST_MESSAGE_DISPATCHER_H_ | 71 #endif // REMOTING_PROTOCOL_HOST_MESSAGE_DISPATCHER_H_ |
OLD | NEW |