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

Side by Side Diff: remoting/host/chromoting_host.cc

Issue 10160012: Pass TransportConfig to TransportFactory instead of Transport. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | « no previous file | remoting/protocol/jingle_session.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/host/chromoting_host.h" 5 #include "remoting/host/chromoting_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return; 100 return;
101 state_ = kStarted; 101 state_ = kStarted;
102 102
103 // Create port allocator. 103 // Create port allocator.
104 // TODO(sergeyu): Replace the code below with HostPortAllocator when 104 // TODO(sergeyu): Replace the code below with HostPortAllocator when
105 // it is implemented. 105 // it is implemented.
106 scoped_ptr<talk_base::NetworkManager> network_manager( 106 scoped_ptr<talk_base::NetworkManager> network_manager(
107 new talk_base::BasicNetworkManager()); 107 new talk_base::BasicNetworkManager());
108 scoped_ptr<talk_base::PacketSocketFactory> socket_factory( 108 scoped_ptr<talk_base::PacketSocketFactory> socket_factory(
109 new talk_base::BasicPacketSocketFactory()); 109 new talk_base::BasicPacketSocketFactory());
110 scoped_ptr<cricket::PortAllocator> port_allocator; 110 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator(
111 new cricket::HttpPortAllocator(
112 network_manager.get(), socket_factory.get(), ""));
113
111 114
112 // We always use PseudoTcp to provide a reliable channel. It 115 // We always use PseudoTcp to provide a reliable channel. It
113 // provides poor performance when combined with TCP-based transport, 116 // provides poor performance when combined with TCP-based transport,
114 // so we have to disable TCP ports. 117 // so we have to disable TCP ports.
115 int port_allocator_flags = cricket::PORTALLOCATOR_DISABLE_TCP; 118 int port_allocator_flags = cricket::PORTALLOCATOR_DISABLE_TCP;
116 if (network_settings_.nat_traversal_mode == 119 if (network_settings_.nat_traversal_mode !=
117 NetworkSettings::NAT_TRAVERSAL_ENABLED) { 120 NetworkSettings::NAT_TRAVERSAL_ENABLED) {
118 port_allocator.reset(new cricket::HttpPortAllocator(
119 network_manager.get(), socket_factory.get(), ""));
120 } else {
121 port_allocator_flags |= cricket::PORTALLOCATOR_DISABLE_STUN | 121 port_allocator_flags |= cricket::PORTALLOCATOR_DISABLE_STUN |
122 cricket::PORTALLOCATOR_DISABLE_RELAY; 122 cricket::PORTALLOCATOR_DISABLE_RELAY;
123 port_allocator.reset(
124 new cricket::BasicPortAllocator(network_manager.get(),
125 socket_factory.get()));
126 } 123 }
127 port_allocator->set_flags(port_allocator_flags); 124 port_allocator->set_flags(port_allocator_flags);
128 port_allocator->SetPortRange(network_settings_.min_port, 125 port_allocator->SetPortRange(network_settings_.min_port,
129 network_settings_.max_port); 126 network_settings_.max_port);
130 127
131 bool incoming_only = network_settings_.nat_traversal_mode == 128 bool incoming_only = network_settings_.nat_traversal_mode ==
132 NetworkSettings::NAT_TRAVERSAL_DISABLED; 129 NetworkSettings::NAT_TRAVERSAL_DISABLED;
133 130
134 scoped_ptr<protocol::TransportFactory> transport_factory( 131 scoped_ptr<protocol::TransportFactory> transport_factory(
135 new protocol::LibjingleTransportFactory( 132 new protocol::LibjingleTransportFactory(
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 OnShutdown()); 448 OnShutdown());
452 449
453 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); 450 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin();
454 it != shutdown_tasks_.end(); ++it) { 451 it != shutdown_tasks_.end(); ++it) {
455 it->Run(); 452 it->Run();
456 } 453 }
457 shutdown_tasks_.clear(); 454 shutdown_tasks_.clear();
458 } 455 }
459 456
460 } // namespace remoting 457 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/jingle_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698