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

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

Issue 8468022: Refactor channel dispatchers on the host side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
6 #define REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
7
8 #include "base/basictypes.h"
9 #include "remoting/protocol/message_reader.h"
10
11 namespace remoting {
12 namespace protocol {
13
14 class EventMessage;
15 class InputStub;
16 class Session;
17
18 // HostEventDispatcher dispatches incoming messages on the event
19 // channel to InputStub.
20 class HostEventDispatcher {
21 public:
22 typedef base::Callback<void(int64)> SequenceNumberCallback;
23
24 HostEventDispatcher();
25 virtual ~HostEventDispatcher();
26
27 // Initialize the event channel and the dispatcher for the
28 // |session|. Doesn't take ownership of |session|.
Wez 2011/11/17 22:25:16 nit: Caller retains ...
Sergey Ulanov 2011/11/17 22:41:39 Done.
29 void Init(Session* session);
30
31 // Set InputStub that will be called for each incoming input
32 // message. Doesn't take ownershipt of |input_stub|. It must outlive
33 // the dispatcher.
Wez 2011/11/17 22:25:16 typo, and nit: Caller retains ...
Sergey Ulanov 2011/11/17 22:41:39 Caller doesn't own input_stub, so i think "caller
34 void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; }
35
36 // Set callback that will be called with sequence number received in
Wez 2011/11/17 22:25:16 nit: Set a callback to notify of each message's se
Sergey Ulanov 2011/11/17 22:41:39 Done.
37 // each message.
Wez 2011/11/17 22:25:16 Clarify that this callback is not permitted to tea
Sergey Ulanov 2011/11/17 22:41:39 Done.
38 void set_sequence_number_callback(const SequenceNumberCallback& value) {
39 sequence_number_callback_ = value;
40 }
41
42 private:
43 // This method is called by |reader_| when a message is received.
44 void OnMessageReceived(EventMessage* message,
45 const base::Closure& done_task);
46
47 InputStub* input_stub_;
48 SequenceNumberCallback sequence_number_callback_;
49
50 ProtobufMessageReader<EventMessage> reader_;
51
52 DISALLOW_COPY_AND_ASSIGN(HostEventDispatcher);
53 };
54
55 } // namespace protocol
56 } // namespace remoting
57
58 #endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698