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

Side by Side Diff: remoting/protocol/channel_dispatcher_base.cc

Issue 10823323: Add support for multiplexed channels in remoting::protocol::Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/channel_dispatcher_base.h" 5 #include "remoting/protocol/channel_dispatcher_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/socket/stream_socket.h" 8 #include "net/socket/stream_socket.h"
9 #include "remoting/protocol/channel_factory.h"
9 #include "remoting/protocol/session.h" 10 #include "remoting/protocol/session.h"
10 11
11 namespace remoting { 12 namespace remoting {
12 namespace protocol { 13 namespace protocol {
13 14
14 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name) 15 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name)
15 : channel_name_(channel_name), 16 : channel_name_(channel_name),
16 session_(NULL) { 17 channel_factory_(NULL) {
17 } 18 }
18 19
19 ChannelDispatcherBase::~ChannelDispatcherBase() { 20 ChannelDispatcherBase::~ChannelDispatcherBase() {
20 if (session_) 21 if (channel_factory_)
21 session_->CancelChannelCreation(channel_name_); 22 channel_factory_->CancelChannelCreation(channel_name_);
22 } 23 }
23 24
24 void ChannelDispatcherBase::Init(Session* session, 25 void ChannelDispatcherBase::Init(Session* session,
25 const InitializedCallback& callback) { 26 const InitializedCallback& callback) {
26 DCHECK(session); 27 DCHECK(session);
27 session_ = session; 28 channel_factory_ = session->GetTransportChannelFactory();
28 initialized_callback_ = callback; 29 initialized_callback_ = callback;
29 30
30 session_->CreateStreamChannel(channel_name_, base::Bind( 31 channel_factory_->CreateStreamChannel(channel_name_, base::Bind(
31 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this))); 32 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
32 } 33 }
33 34
34 void ChannelDispatcherBase::OnChannelReady( 35 void ChannelDispatcherBase::OnChannelReady(
35 scoped_ptr<net::StreamSocket> socket) { 36 scoped_ptr<net::StreamSocket> socket) {
36 if (!socket.get()) { 37 if (!socket.get()) {
37 initialized_callback_.Run(false); 38 initialized_callback_.Run(false);
38 return; 39 return;
39 } 40 }
40 41
41 channel_ = socket.Pass(); 42 channel_ = socket.Pass();
42 43
43 OnInitialized(); 44 OnInitialized();
44 45
45 initialized_callback_.Run(true); 46 initialized_callback_.Run(true);
46 } 47 }
47 48
48 } // namespace protocol 49 } // namespace protocol
49 } // namespace remoting 50 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/channel_multiplexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698