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

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
« no previous file with comments | « remoting/protocol/host_control_dispatcher.cc ('k') | remoting/protocol/host_event_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0ee1a702d2c1c126056a595e64ad5816c29e7246
--- /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|. Caller retains ownership of |session|.
+ void Init(Session* session);
+
+ // Set InputStub that will be called for each incoming input
+ // message. Doesn't take ownership of |input_stub|. It must outlive
+ // the dispatcher.
+ void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; }
+
+ // Set callback to notify of each message's sequence number. The
+ // callback cannot tear down this object.
+ 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_
« 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