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

Unified Diff: remoting/protocol/host_control_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_control_dispatcher.h
diff --git a/remoting/protocol/host_control_dispatcher.h b/remoting/protocol/host_control_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1bf67f0184227c3e74690655589aec3a1cb6677
--- /dev/null
+++ b/remoting/protocol/host_control_dispatcher.h
@@ -0,0 +1,55 @@
+// 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_CONTROL_DISPATCHER_H_
+#define REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "remoting/protocol/client_stub.h"
+#include "remoting/protocol/message_reader.h"
+
+namespace base {
+class MessageLoopProxy;
+} // namespace base
+
+namespace remoting {
+namespace protocol {
+
+class BufferedSocketWriter;
+class ControlMessage;
+class HostStub;
+class Session;
+
+// HostControlDispatcher manages control channel on the host side. It
+// dispatches incoming messages on the control channel to HostStub,
+// and also implements ClientStub for outgoing messages.
+class HostControlDispatcher : public ClientStub {
+ public:
+ explicit HostControlDispatcher(base::MessageLoopProxy* message_loop);
Wez 2011/11/17 02:03:40 What is message_loop used for?
Sergey Ulanov 2011/11/17 18:38:14 Removed it - we don't really need it because it al
+ virtual ~HostControlDispatcher();
+
+ void Init(Session* session, HostStub* host_stub);
Wez 2011/11/17 02:03:40 How are session & host_stub used, and who owns the
Sergey Ulanov 2011/11/17 18:38:14 Done.
+
+ // Stop writing. Must be called on the network thread when the
+ // underlying socket is being destroyed.
+ void Close();
Wez 2011/11/17 02:03:40 Calling code doesn't seem to use this - it just de
Sergey Ulanov 2011/11/17 18:38:14 Done. Also in HostInputDispatcher.
+
+ private:
+ // This method is called by |reader_| when a message is received.
+ void OnMessageReceived(ControlMessage* message,
+ const base::Closure& done_task);
+
+ HostStub* host_stub_;
+
+ ProtobufMessageReader<ControlMessage> reader_;
+ scoped_refptr<BufferedSocketWriter> writer_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostControlDispatcher);
+};
+
+} // namespace protocol
+} // namespace remoting
+
+#endif // REMOTING_PROTOCOL_HOST_CONTROL_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698