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

Unified Diff: remoting/protocol/chromium_port_allocator.cc

Issue 1521883006: Add TransportContext class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/chromium_port_allocator.h ('k') | remoting/protocol/chromium_port_allocator_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/chromium_port_allocator.cc
diff --git a/remoting/protocol/chromium_port_allocator.cc b/remoting/protocol/chromium_port_allocator.cc
index ffe675667a558d1d96a5c6d987e754d83bd49a0b..5a5c103b541ec058b5389dcc928bbe72b356801a 100644
--- a/remoting/protocol/chromium_port_allocator.cc
+++ b/remoting/protocol/chromium_port_allocator.cc
@@ -12,7 +12,6 @@
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_context_getter.h"
#include "remoting/protocol/chromium_socket_factory.h"
-#include "remoting/protocol/network_settings.h"
#include "url/gurl.h"
namespace remoting {
@@ -131,35 +130,13 @@ void ChromiumPortAllocatorSession::OnURLFetchComplete(
// static
scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create(
- const scoped_refptr<net::URLRequestContextGetter>& url_context,
- const NetworkSettings& network_settings) {
+ const scoped_refptr<net::URLRequestContextGetter>& url_context) {
scoped_ptr<rtc::NetworkManager> network_manager(
new rtc::BasicNetworkManager());
scoped_ptr<rtc::PacketSocketFactory> socket_factory(
new ChromiumPacketSocketFactory());
- scoped_ptr<ChromiumPortAllocator> result(
- new ChromiumPortAllocator(url_context, network_manager.Pass(),
- socket_factory.Pass()));
-
- // We always use PseudoTcp to provide a reliable channel. It provides poor
- // performance when combined with TCP-based transport, so we have to disable
- // TCP ports. ENABLE_SHARED_UFRAG flag is specified so that the same username
- // fragment is shared between all candidates for this channel.
- int flags = cricket::PORTALLOCATOR_DISABLE_TCP |
- cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
- cricket::PORTALLOCATOR_ENABLE_IPV6;
-
- if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_STUN))
- flags |= cricket::PORTALLOCATOR_DISABLE_STUN;
-
- if (!(network_settings.flags & NetworkSettings::NAT_TRAVERSAL_RELAY))
- flags |= cricket::PORTALLOCATOR_DISABLE_RELAY;
-
- result->set_flags(flags);
- result->SetPortRange(network_settings.port_range.min_port,
- network_settings.port_range.max_port);
-
- return result.Pass();
+ return make_scoped_ptr(new ChromiumPortAllocator(
+ url_context, network_manager.Pass(), socket_factory.Pass()));
}
ChromiumPortAllocator::ChromiumPortAllocator(
@@ -173,8 +150,7 @@ ChromiumPortAllocator::ChromiumPortAllocator(
network_manager_(network_manager.Pass()),
socket_factory_(socket_factory.Pass()) {}
-ChromiumPortAllocator::~ChromiumPortAllocator() {
-}
+ChromiumPortAllocator::~ChromiumPortAllocator() {}
cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal(
const std::string& content_name,
@@ -186,5 +162,16 @@ cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal(
stun_hosts(), relay_hosts(), relay_token(), url_context_);
}
+ChromiumPortAllocatorFactory::ChromiumPortAllocatorFactory(
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
+ : url_request_context_getter_(url_request_context_getter) {}
+
+ChromiumPortAllocatorFactory::~ChromiumPortAllocatorFactory() {}
+
+scoped_ptr<cricket::HttpPortAllocatorBase>
+ChromiumPortAllocatorFactory::CreatePortAllocator() {
+ return ChromiumPortAllocator::Create(url_request_context_getter_);
+}
+
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/chromium_port_allocator.h ('k') | remoting/protocol/chromium_port_allocator_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698