OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/devtools/device/port_forwarding_controller.h" | 5 #include "chrome/browser/devtools/device/port_forwarding_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/profiler/scoped_tracker.h" | |
15 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
18 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
19 #include "chrome/browser/devtools/devtools_protocol.h" | 18 #include "chrome/browser/devtools/devtools_protocol.h" |
20 #include "chrome/browser/devtools/devtools_protocol_constants.h" | 19 #include "chrome/browser/devtools/devtools_protocol_constants.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
23 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 22 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 net::DEFAULT_PRIORITY, | 81 net::DEFAULT_PRIORITY, |
83 &address_list_, | 82 &address_list_, |
84 base::Bind(&SocketTunnel::OnResolved, base::Unretained(this)), | 83 base::Bind(&SocketTunnel::OnResolved, base::Unretained(this)), |
85 NULL, | 84 NULL, |
86 net::BoundNetLog()); | 85 net::BoundNetLog()); |
87 if (result != net::ERR_IO_PENDING) | 86 if (result != net::ERR_IO_PENDING) |
88 OnResolved(result); | 87 OnResolved(result); |
89 } | 88 } |
90 | 89 |
91 void OnResolved(int result) { | 90 void OnResolved(int result) { |
92 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. | |
93 tracked_objects::ScopedTracker tracking_profile( | |
94 FROM_HERE_WITH_EXPLICIT_FUNCTION("436634 SocketTunnel::OnResolved")); | |
95 | |
96 if (result < 0) { | 91 if (result < 0) { |
97 SelfDestruct(); | 92 SelfDestruct(); |
98 return; | 93 return; |
99 } | 94 } |
100 | 95 |
101 host_socket_.reset(new net::TCPClientSocket(address_list_, NULL, | 96 host_socket_.reset(new net::TCPClientSocket(address_list_, NULL, |
102 net::NetLog::Source())); | 97 net::NetLog::Source())); |
103 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, | 98 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, |
104 base::Unretained(this))); | 99 base::Unretained(this))); |
105 if (result != net::ERR_IO_PENDING) | 100 if (result != net::ERR_IO_PENDING) |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 registry_copy.push_back(it->second); | 550 registry_copy.push_back(it->second); |
556 } | 551 } |
557 STLDeleteElements(®istry_copy); | 552 STLDeleteElements(®istry_copy); |
558 } | 553 } |
559 } | 554 } |
560 | 555 |
561 void PortForwardingController::UpdateConnections() { | 556 void PortForwardingController::UpdateConnections() { |
562 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) | 557 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) |
563 it->second->UpdateForwardingMap(forwarding_map_); | 558 it->second->UpdateForwardingMap(forwarding_map_); |
564 } | 559 } |
OLD | NEW |