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

Unified Diff: remoting/protocol/host_input_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_input_dispatcher.h
diff --git a/remoting/protocol/host_input_dispatcher.h b/remoting/protocol/host_input_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..9eef58af884790c4c0eb3594061012cc05fff5ed
--- /dev/null
+++ b/remoting/protocol/host_input_dispatcher.h
@@ -0,0 +1,52 @@
+// 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_INPUT_DISPATCHER_H_
+#define REMOTING_PROTOCOL_HOST_INPUT_DISPATCHER_H_
+
+#include "base/basictypes.h"
+#include "remoting/protocol/message_reader.h"
+
+namespace remoting {
+namespace protocol {
+
+class EventMessage;
+class InputStub;
+class Session;
+
+// A message dispatcher used to listen for messages received in
+// protocol::Session. It dispatches messages to the corresponding
+// handler.
+class HostInputDispatcher {
+ public:
+ typedef base::Callback<void(int64)> SequenceNumberCallback;
+
+ HostInputDispatcher();
+ virtual ~HostInputDispatcher();
+
+ // Initialize the message dispatcher with the given connection and
+ // message handlers.
Wez 2011/11/17 02:03:40 How are they used, and who owns them, etc?
Sergey Ulanov 2011/11/17 18:38:14 Done.
+ void Init(Session* session,
+ InputStub* input_stub,
+ const SequenceNumberCallback& seq_num_callback);
Wez 2011/11/17 02:03:40 Style guide says no abbreviated names. :(
Sergey Ulanov 2011/11/17 18:38:14 Done.
+
+ void Close();
+
+ 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 seq_num_callback_;
+
+ ProtobufMessageReader<EventMessage> reader_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostInputDispatcher);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_HOST_INPUT_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698