| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/transport_context.h" | 5 #include "remoting/protocol/transport_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "remoting/protocol/port_allocator_factory.h" | 11 #include "remoting/protocol/port_allocator_factory.h" |
| 12 #include "third_party/webrtc/p2p/client/httpportallocator.h" | 12 #include "third_party/webrtc/p2p/client/httpportallocator.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 namespace protocol { | 15 namespace protocol { |
| 16 | 16 |
| 17 // Get fresh STUN/Relay configuration every hour. | 17 // Get fresh STUN/Relay configuration every hour. |
| 18 static const int kJingleInfoUpdatePeriodSeconds = 3600; | 18 static const int kJingleInfoUpdatePeriodSeconds = 3600; |
| 19 | 19 |
| 20 TransportContext::TransportContext( | 20 TransportContext::TransportContext( |
| 21 SignalStrategy* signal_strategy, | 21 SignalStrategy* signal_strategy, |
| 22 scoped_ptr<PortAllocatorFactory> port_allocator_factory, | 22 scoped_ptr<PortAllocatorFactory> port_allocator_factory, |
| 23 const NetworkSettings& network_settings, | 23 const NetworkSettings& network_settings, |
| 24 TransportRole role) | 24 TransportRole role) |
| 25 : signal_strategy_(signal_strategy), | 25 : signal_strategy_(signal_strategy), |
| 26 port_allocator_factory_(port_allocator_factory.Pass()), | 26 port_allocator_factory_(std::move(port_allocator_factory)), |
| 27 network_settings_(network_settings), | 27 network_settings_(network_settings), |
| 28 role_(role) {} | 28 role_(role) {} |
| 29 | 29 |
| 30 TransportContext::~TransportContext() {} | 30 TransportContext::~TransportContext() {} |
| 31 | 31 |
| 32 void TransportContext::Prepare() { | 32 void TransportContext::Prepare() { |
| 33 EnsureFreshJingleInfo(); | 33 EnsureFreshJingleInfo(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void TransportContext::CreatePortAllocator( | 36 void TransportContext::CreatePortAllocator( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (!(network_settings_.flags & NetworkSettings::NAT_TRAVERSAL_STUN)) | 108 if (!(network_settings_.flags & NetworkSettings::NAT_TRAVERSAL_STUN)) |
| 109 flags |= cricket::PORTALLOCATOR_DISABLE_STUN; | 109 flags |= cricket::PORTALLOCATOR_DISABLE_STUN; |
| 110 | 110 |
| 111 if (!(network_settings_.flags & NetworkSettings::NAT_TRAVERSAL_RELAY)) | 111 if (!(network_settings_.flags & NetworkSettings::NAT_TRAVERSAL_RELAY)) |
| 112 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY; | 112 flags |= cricket::PORTALLOCATOR_DISABLE_RELAY; |
| 113 | 113 |
| 114 result->set_flags(flags); | 114 result->set_flags(flags); |
| 115 result->SetPortRange(network_settings_.port_range.min_port, | 115 result->SetPortRange(network_settings_.port_range.min_port, |
| 116 network_settings_.port_range.max_port); | 116 network_settings_.port_range.max_port); |
| 117 | 117 |
| 118 return result.Pass(); | 118 return std::move(result); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace protocol | 121 } // namespace protocol |
| 122 } // namespace remoting | 122 } // namespace remoting |
| OLD | NEW |