 Chromium Code Reviews
 Chromium Code Reviews Issue 8468022:
  Refactor channel dispatchers on the host side.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 8468022:
  Refactor channel dispatchers on the host side.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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..bd3e11c7bb1c669ab38eec4ea82cb461e87e01ea | 
| --- /dev/null | 
| +++ b/remoting/protocol/host_control_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_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 dispatches incoming messages on the control | 
| +// channel to HostStub, and also implements ClientStub for outgoing | 
| +// messages. | 
| +class HostControlDispatcher : public ClientStub { | 
| + public: | 
| + HostControlDispatcher(); | 
| + virtual ~HostControlDispatcher(); | 
| + | 
| + // Initialize the control channel and the dispatcher for the | 
| + // |session|. Doesn't take ownership of |session|. | 
| 
Wez
2011/11/17 22:25:16
nit: Doesn't take... -> Caller retains ...
 
Sergey Ulanov
2011/11/17 22:41:39
I moved this method to ChannelDispatcherBase in an
 | 
| + void Init(Session* session); | 
| + | 
| + // Sets HostStub that will be called for each incoming control | 
| + // message. Doesn't take ownershipt of |host_stub|. It must outlive | 
| 
Wez
2011/11/17 22:25:16
typo: ownershipt
Suggest:
Caller retains ownershi
 
Sergey Ulanov
2011/11/17 22:41:39
Caller doesn't own |host_stub|
 | 
| + // this dispatcher. | 
| + void set_host_stub(HostStub* host_stub) { host_stub_ = host_stub; } | 
| + | 
| + 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_ |