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> | 7 #include <stdint.h> |
| 8 |
| 9 #include <memory> |
8 #include <utility> | 10 #include <utility> |
9 | 11 |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
13 #include "content/renderer/p2p/socket_dispatcher.h" | 15 #include "content/renderer/p2p/socket_dispatcher.h" |
14 | 16 |
15 namespace content { | 17 namespace content { |
16 | 18 |
17 P2PPortAllocator::P2PPortAllocator( | 19 P2PPortAllocator::P2PPortAllocator( |
18 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, | 20 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, |
19 scoped_ptr<rtc::NetworkManager> network_manager, | 21 std::unique_ptr<rtc::NetworkManager> network_manager, |
20 rtc::PacketSocketFactory* socket_factory, | 22 rtc::PacketSocketFactory* socket_factory, |
21 const Config& config, | 23 const Config& config, |
22 const GURL& origin, | 24 const GURL& origin, |
23 const scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 25 const scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
24 : cricket::BasicPortAllocator(network_manager.get(), socket_factory), | 26 : cricket::BasicPortAllocator(network_manager.get(), socket_factory), |
25 network_manager_(std::move(network_manager)), | 27 network_manager_(std::move(network_manager)), |
26 socket_dispatcher_(socket_dispatcher), | 28 socket_dispatcher_(socket_dispatcher), |
27 config_(config), | 29 config_(config), |
28 origin_(origin), | 30 origin_(origin), |
29 network_manager_task_runner_(task_runner) { | 31 network_manager_task_runner_(task_runner) { |
(...skipping 22 matching lines...) Expand all Loading... |
52 // TODO(guoweis): P2PPortAllocator is also deleted in the wrong thread | 54 // TODO(guoweis): P2PPortAllocator is also deleted in the wrong thread |
53 // here. It's created in signaling thread, and held by webrtc::PeerConnection, | 55 // here. It's created in signaling thread, and held by webrtc::PeerConnection, |
54 // only used on worker thread. The destructor is invoked on signaling thread | 56 // only used on worker thread. The destructor is invoked on signaling thread |
55 // again. crbug.com/535761. DeleteSoon can be removed once the bug is fixed. | 57 // again. crbug.com/535761. DeleteSoon can be removed once the bug is fixed. |
56 P2PPortAllocator::~P2PPortAllocator() { | 58 P2PPortAllocator::~P2PPortAllocator() { |
57 network_manager_task_runner_->DeleteSoon(FROM_HERE, | 59 network_manager_task_runner_->DeleteSoon(FROM_HERE, |
58 network_manager_.release()); | 60 network_manager_.release()); |
59 } | 61 } |
60 | 62 |
61 } // namespace content | 63 } // namespace content |
OLD | NEW |