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

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

Issue 841773005: Cleanup channel dispatchers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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_HOST_EVENT_DISPATCHER_H_ 5 #ifndef REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
6 #define REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_ 6 #define REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
7 7
8 #include "remoting/protocol/channel_dispatcher_base.h" 8 #include "remoting/protocol/channel_dispatcher_base.h"
9 #include "remoting/protocol/message_reader.h" 9 #include "remoting/protocol/protobuf_message_parser.h"
10 10
11 namespace remoting { 11 namespace remoting {
12 namespace protocol { 12 namespace protocol {
13 13
14 class EventMessage; 14 class EventMessage;
15 class InputStub; 15 class InputStub;
16 16
17 // HostEventDispatcher dispatches incoming messages on the event 17 // HostEventDispatcher dispatches incoming messages on the event
18 // channel to InputStub. 18 // channel to InputStub.
19 class HostEventDispatcher : public ChannelDispatcherBase { 19 class HostEventDispatcher : public ChannelDispatcherBase {
20 public: 20 public:
21 typedef base::Callback<void(int64)> EventTimestampCallback; 21 typedef base::Callback<void(int64)> EventTimestampCallback;
22 22
23 HostEventDispatcher(); 23 HostEventDispatcher();
24 ~HostEventDispatcher() override; 24 ~HostEventDispatcher() override;
25 25
26 // Set InputStub that will be called for each incoming input 26 // Set InputStub that will be called for each incoming input
27 // message. Doesn't take ownership of |input_stub|. It must outlive 27 // message. Doesn't take ownership of |input_stub|. It must outlive
28 // the dispatcher. 28 // the dispatcher.
29 void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; } 29 void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; }
30 30
31 // Set callback to notify of each message's sequence number. The 31 // Set callback to notify of each message's sequence number. The
32 // callback cannot tear down this object. 32 // callback cannot tear down this object.
33 void set_event_timestamp_callback(const EventTimestampCallback& value) { 33 void set_event_timestamp_callback(const EventTimestampCallback& value) {
34 event_timestamp_callback_ = value; 34 event_timestamp_callback_ = value;
35 } 35 }
36 36
37 protected:
38 // ChannelDispatcherBase overrides.
39 void OnInitialized() override;
40
41 private: 37 private:
42 void OnMessageReceived(scoped_ptr<EventMessage> message, 38 void OnMessageReceived(scoped_ptr<EventMessage> message,
43 const base::Closure& done_task); 39 const base::Closure& done_task);
44 40
45 InputStub* input_stub_; 41 InputStub* input_stub_;
46 EventTimestampCallback event_timestamp_callback_; 42 EventTimestampCallback event_timestamp_callback_;
47 43
48 ProtobufMessageReader<EventMessage> reader_; 44 ProtobufMessageParser<EventMessage> parser_;
49 45
50 DISALLOW_COPY_AND_ASSIGN(HostEventDispatcher); 46 DISALLOW_COPY_AND_ASSIGN(HostEventDispatcher);
51 }; 47 };
52 48
53 } // namespace protocol 49 } // namespace protocol
54 } // namespace remoting 50 } // namespace remoting
55 51
56 #endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_ 52 #endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « remoting/protocol/host_control_dispatcher.cc ('k') | remoting/protocol/host_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698