| OLD | NEW |
| 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 "content/renderer/p2p/port_allocator.h" | 5 #include "content/renderer/p2p/port_allocator.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 10 #include "content/renderer/p2p/socket_dispatcher.h" | 12 #include "content/renderer/p2p/socket_dispatcher.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 | 15 |
| 14 P2PPortAllocator::P2PPortAllocator( | 16 P2PPortAllocator::P2PPortAllocator( |
| 15 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, | 17 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, |
| 16 scoped_ptr<rtc::NetworkManager> network_manager, | 18 scoped_ptr<rtc::NetworkManager> network_manager, |
| 17 rtc::PacketSocketFactory* socket_factory, | 19 rtc::PacketSocketFactory* socket_factory, |
| 18 const Config& config, | 20 const Config& config, |
| 19 const GURL& origin, | 21 const GURL& origin, |
| 20 const scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 22 const scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 21 : cricket::BasicPortAllocator(network_manager.get(), socket_factory), | 23 : cricket::BasicPortAllocator(network_manager.get(), socket_factory), |
| 22 network_manager_(network_manager.Pass()), | 24 network_manager_(network_manager.Pass()), |
| 23 socket_dispatcher_(socket_dispatcher), | 25 socket_dispatcher_(socket_dispatcher), |
| 24 config_(config), | 26 config_(config), |
| 25 origin_(origin), | 27 origin_(origin), |
| 26 network_manager_task_runner_(task_runner) { | 28 network_manager_task_runner_(task_runner) { |
| 27 uint32 flags = 0; | 29 uint32_t flags = 0; |
| 28 if (!config_.enable_multiple_routes) { | 30 if (!config_.enable_multiple_routes) { |
| 29 flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION; | 31 flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION; |
| 30 } | 32 } |
| 31 if (!config_.enable_default_local_candidate) { | 33 if (!config_.enable_default_local_candidate) { |
| 32 flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE; | 34 flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE; |
| 33 } | 35 } |
| 34 if (!config_.enable_nonproxied_udp) { | 36 if (!config_.enable_nonproxied_udp) { |
| 35 flags |= cricket::PORTALLOCATOR_DISABLE_UDP | | 37 flags |= cricket::PORTALLOCATOR_DISABLE_UDP | |
| 36 cricket::PORTALLOCATOR_DISABLE_STUN | | 38 cricket::PORTALLOCATOR_DISABLE_STUN | |
| 37 cricket::PORTALLOCATOR_DISABLE_UDP_RELAY; | 39 cricket::PORTALLOCATOR_DISABLE_UDP_RELAY; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 // TODO(guoweis): P2PPortAllocator is also deleted in the wrong thread | 51 // TODO(guoweis): P2PPortAllocator is also deleted in the wrong thread |
| 50 // here. It's created in signaling thread, and held by webrtc::PeerConnection, | 52 // here. It's created in signaling thread, and held by webrtc::PeerConnection, |
| 51 // only used on worker thread. The destructor is invoked on signaling thread | 53 // only used on worker thread. The destructor is invoked on signaling thread |
| 52 // again. crbug.com/535761. DeleteSoon can be removed once the bug is fixed. | 54 // again. crbug.com/535761. DeleteSoon can be removed once the bug is fixed. |
| 53 P2PPortAllocator::~P2PPortAllocator() { | 55 P2PPortAllocator::~P2PPortAllocator() { |
| 54 network_manager_task_runner_->DeleteSoon(FROM_HERE, | 56 network_manager_task_runner_->DeleteSoon(FROM_HERE, |
| 55 network_manager_.release()); | 57 network_manager_.release()); |
| 56 } | 58 } |
| 57 | 59 |
| 58 } // namespace content | 60 } // namespace content |
| OLD | NEW |