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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/host_event_dispatcher.h
diff --git a/remoting/protocol/host_event_dispatcher.h b/remoting/protocol/host_event_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..5b3fc18100baff9d0bac621c0401918992948b11
--- /dev/null
+++ b/remoting/protocol/host_event_dispatcher.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
+#define REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_
+
+#include "base/basictypes.h"
+#include "remoting/protocol/message_reader.h"
+
+namespace remoting {
+namespace protocol {
+
+class EventMessage;
+class InputStub;
+class Session;
+
+// HostEventDispatcher dispatches incoming messages on the event
+// channel to InputStub.
+class HostEventDispatcher {
+ public:
+ typedef base::Callback<void(int64)> SequenceNumberCallback;
+
+ HostEventDispatcher();
+ virtual ~HostEventDispatcher();
+
+ // Initialize the event channel and the dispatcher for the
+ // |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.
+ void Init(Session* session);
+
+ // Set InputStub that will be called for each incoming input
+ // message. Doesn't take ownershipt of |input_stub|. It must outlive
+ // 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
+ void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; }
+
+ // 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.
+ // 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.
+ void set_sequence_number_callback(const SequenceNumberCallback& value) {
+ sequence_number_callback_ = value;
+ }
+
+ private:
+ // This method is called by |reader_| when a message is received.
+ void OnMessageReceived(EventMessage* message,
+ const base::Closure& done_task);
+
+ InputStub* input_stub_;
+ SequenceNumberCallback sequence_number_callback_;
+
+ ProtobufMessageReader<EventMessage> reader_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostEventDispatcher);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_HOST_EVENT_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698