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

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

Issue 1420273002: Add TransportSession interface to prepare for WebRTC-based transport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
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 "remoting/protocol/p2p_stream_socket.h" 8 #include "remoting/protocol/p2p_stream_socket.h"
9 #include "remoting/protocol/session.h" 9 #include "remoting/protocol/session.h"
10 #include "remoting/protocol/session_config.h" 10 #include "remoting/protocol/session_config.h"
11 #include "remoting/protocol/stream_channel_factory.h" 11 #include "remoting/protocol/stream_channel_factory.h"
12 #include "remoting/protocol/transport.h"
12 13
13 namespace remoting { 14 namespace remoting {
14 namespace protocol { 15 namespace protocol {
15 16
16 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name) 17 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name)
17 : channel_name_(channel_name), 18 : channel_name_(channel_name),
18 channel_factory_(nullptr), 19 channel_factory_(nullptr),
19 event_handler_(nullptr) { 20 event_handler_(nullptr) {
20 } 21 }
21 22
22 ChannelDispatcherBase::~ChannelDispatcherBase() { 23 ChannelDispatcherBase::~ChannelDispatcherBase() {
23 if (channel_factory_) 24 if (channel_factory_)
24 channel_factory_->CancelChannelCreation(channel_name_); 25 channel_factory_->CancelChannelCreation(channel_name_);
25 } 26 }
26 27
27 void ChannelDispatcherBase::Init(Session* session, 28 void ChannelDispatcherBase::Init(Session* session,
28 const ChannelConfig& config, 29 const ChannelConfig& config,
29 EventHandler* event_handler) { 30 EventHandler* event_handler) {
30 DCHECK(session); 31 DCHECK(session);
31 switch (config.transport) { 32 switch (config.transport) {
32 case ChannelConfig::TRANSPORT_MUX_STREAM: 33 case ChannelConfig::TRANSPORT_MUX_STREAM:
33 channel_factory_ = session->GetMultiplexedChannelFactory(); 34 channel_factory_ =
35 session->GetTransportSession()->GetMultiplexedChannelFactory();
34 break; 36 break;
35 37
36 case ChannelConfig::TRANSPORT_QUIC_STREAM: 38 case ChannelConfig::TRANSPORT_QUIC_STREAM:
37 channel_factory_ = session->GetQuicChannelFactory(); 39 channel_factory_ = session->GetQuicChannelFactory();
38 break; 40 break;
39 41
40 case ChannelConfig::TRANSPORT_STREAM: 42 case ChannelConfig::TRANSPORT_STREAM:
41 channel_factory_ = session->GetTransportChannelFactory(); 43 channel_factory_ =
44 session->GetTransportSession()->GetStreamChannelFactory();
42 break; 45 break;
43 46
44 default: 47 default:
45 LOG(FATAL) << "Unknown transport type: " << config.transport; 48 LOG(FATAL) << "Unknown transport type: " << config.transport;
46 } 49 }
47 50
48 event_handler_ = event_handler; 51 event_handler_ = event_handler;
49 52
50 channel_factory_->CreateChannel(channel_name_, base::Bind( 53 channel_factory_->CreateChannel(channel_name_, base::Bind(
51 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this))); 54 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
(...skipping 18 matching lines...) Expand all
70 73
71 event_handler_->OnChannelInitialized(this); 74 event_handler_->OnChannelInitialized(this);
72 } 75 }
73 76
74 void ChannelDispatcherBase::OnReadWriteFailed(int error) { 77 void ChannelDispatcherBase::OnReadWriteFailed(int error) {
75 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR); 78 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
76 } 79 }
77 80
78 } // namespace protocol 81 } // namespace protocol
79 } // namespace remoting 82 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/session_manager_factory.cc ('k') | remoting/protocol/channel_multiplexer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698