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

Side by Side Diff: content/renderer/p2p/port_allocator.cc

Issue 2113523003: Do FilteringNetworkManager::CheckPermission from new Initialize method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Responding to comments. Created 4 years, 5 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
« no previous file with comments | « content/renderer/p2p/port_allocator.h ('k') | no next file » | 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 "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 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/renderer/p2p/socket_dispatcher.h" 15 #include "content/renderer/p2p/socket_dispatcher.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 P2PPortAllocator::P2PPortAllocator( 19 P2PPortAllocator::P2PPortAllocator(
20 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, 20 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher,
21 std::unique_ptr<rtc::NetworkManager> network_manager, 21 std::unique_ptr<rtc::NetworkManager> network_manager,
22 rtc::PacketSocketFactory* socket_factory, 22 rtc::PacketSocketFactory* socket_factory,
23 const Config& config, 23 const Config& config,
24 const GURL& origin) 24 const GURL& origin)
25 : cricket::BasicPortAllocator(network_manager.get(), socket_factory), 25 : cricket::BasicPortAllocator(network_manager.get(), socket_factory),
26 network_manager_(std::move(network_manager)), 26 network_manager_(std::move(network_manager)),
27 socket_dispatcher_(socket_dispatcher), 27 socket_dispatcher_(socket_dispatcher),
28 config_(config), 28 config_(config),
29 origin_(origin) { 29 origin_(origin) {
30 RTC_DCHECK(network_manager);
Sergey Ulanov 2016/07/07 21:38:23 This code is not in webrtc, so this should be DCHE
Taylor_Brandstetter 2016/07/07 21:49:06 Thanks for catching that. Force of habit.
30 uint32_t flags = 0; 31 uint32_t flags = 0;
31 if (!config_.enable_multiple_routes) { 32 if (!config_.enable_multiple_routes) {
32 flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION; 33 flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION;
33 } 34 }
34 if (!config_.enable_default_local_candidate) { 35 if (!config_.enable_default_local_candidate) {
35 flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE; 36 flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE;
36 } 37 }
37 if (!config_.enable_nonproxied_udp) { 38 if (!config_.enable_nonproxied_udp) {
38 flags |= cricket::PORTALLOCATOR_DISABLE_UDP | 39 flags |= cricket::PORTALLOCATOR_DISABLE_UDP |
39 cricket::PORTALLOCATOR_DISABLE_STUN | 40 cricket::PORTALLOCATOR_DISABLE_STUN |
40 cricket::PORTALLOCATOR_DISABLE_UDP_RELAY; 41 cricket::PORTALLOCATOR_DISABLE_UDP_RELAY;
41 } 42 }
42 set_flags(flags); 43 set_flags(flags);
43 set_allow_tcp_listen(false); 44 set_allow_tcp_listen(false);
44 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 45 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
45 bool enable_webrtc_stun_origin = 46 bool enable_webrtc_stun_origin =
46 cmd_line->HasSwitch(switches::kEnableWebRtcStunOrigin); 47 cmd_line->HasSwitch(switches::kEnableWebRtcStunOrigin);
47 if (enable_webrtc_stun_origin) { 48 if (enable_webrtc_stun_origin) {
48 set_origin(origin_.spec()); 49 set_origin(origin_.spec());
49 } 50 }
50 } 51 }
51 52
52 P2PPortAllocator::~P2PPortAllocator() {} 53 P2PPortAllocator::~P2PPortAllocator() {}
53 54
55 void P2PPortAllocator::Initialize() {
56 BasicPortAllocator::Initialize();
57 network_manager_->Initialize();
58 }
59
54 } // namespace content 60 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/p2p/port_allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698