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

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

Issue 1413813006: Revert of 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"
13 12
14 namespace remoting { 13 namespace remoting {
15 namespace protocol { 14 namespace protocol {
16 15
17 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name) 16 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name)
18 : channel_name_(channel_name), 17 : channel_name_(channel_name),
19 channel_factory_(nullptr), 18 channel_factory_(nullptr),
20 event_handler_(nullptr) { 19 event_handler_(nullptr) {
21 } 20 }
22 21
23 ChannelDispatcherBase::~ChannelDispatcherBase() { 22 ChannelDispatcherBase::~ChannelDispatcherBase() {
24 if (channel_factory_) 23 if (channel_factory_)
25 channel_factory_->CancelChannelCreation(channel_name_); 24 channel_factory_->CancelChannelCreation(channel_name_);
26 } 25 }
27 26
28 void ChannelDispatcherBase::Init(Session* session, 27 void ChannelDispatcherBase::Init(Session* session,
29 const ChannelConfig& config, 28 const ChannelConfig& config,
30 EventHandler* event_handler) { 29 EventHandler* event_handler) {
31 DCHECK(session); 30 DCHECK(session);
32 switch (config.transport) { 31 switch (config.transport) {
33 case ChannelConfig::TRANSPORT_MUX_STREAM: 32 case ChannelConfig::TRANSPORT_MUX_STREAM:
34 channel_factory_ = 33 channel_factory_ = session->GetMultiplexedChannelFactory();
35 session->GetTransportSession()->GetMultiplexedChannelFactory();
36 break; 34 break;
37 35
38 case ChannelConfig::TRANSPORT_QUIC_STREAM: 36 case ChannelConfig::TRANSPORT_QUIC_STREAM:
39 channel_factory_ = session->GetQuicChannelFactory(); 37 channel_factory_ = session->GetQuicChannelFactory();
40 break; 38 break;
41 39
42 case ChannelConfig::TRANSPORT_STREAM: 40 case ChannelConfig::TRANSPORT_STREAM:
43 channel_factory_ = 41 channel_factory_ = session->GetTransportChannelFactory();
44 session->GetTransportSession()->GetStreamChannelFactory();
45 break; 42 break;
46 43
47 default: 44 default:
48 LOG(FATAL) << "Unknown transport type: " << config.transport; 45 LOG(FATAL) << "Unknown transport type: " << config.transport;
49 } 46 }
50 47
51 event_handler_ = event_handler; 48 event_handler_ = event_handler;
52 49
53 channel_factory_->CreateChannel(channel_name_, base::Bind( 50 channel_factory_->CreateChannel(channel_name_, base::Bind(
54 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this))); 51 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
(...skipping 18 matching lines...) Expand all
73 70
74 event_handler_->OnChannelInitialized(this); 71 event_handler_->OnChannelInitialized(this);
75 } 72 }
76 73
77 void ChannelDispatcherBase::OnReadWriteFailed(int error) { 74 void ChannelDispatcherBase::OnReadWriteFailed(int error) {
78 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR); 75 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
79 } 76 }
80 77
81 } // namespace protocol 78 } // namespace protocol
82 } // namespace remoting 79 } // 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