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

Side by Side Diff: chrome/browser/devtools/device/port_forwarding_controller.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 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
OLDNEW
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/devtools/devtools_protocol_constants.h" 21 #include "chrome/browser/devtools/devtools_protocol_constants.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "components/keyed_service/content/browser_context_dependency_manager.h" 24 #include "components/keyed_service/content/browser_context_dependency_manager.h"
25 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "net/base/address_list.h" 27 #include "net/base/address_list.h"
28 #include "net/base/io_buffer.h" 28 #include "net/base/io_buffer.h"
29 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
30 #include "net/dns/host_resolver.h" 30 #include "net/dns/host_resolver.h"
31 #include "net/log/net_log_source.h"
32 #include "net/log/net_log_with_source.h"
31 #include "net/socket/tcp_client_socket.h" 33 #include "net/socket/tcp_client_socket.h"
32 34
33 using content::BrowserThread; 35 using content::BrowserThread;
34 36
35 namespace { 37 namespace {
36 38
37 const int kBufferSize = 16 * 1024; 39 const int kBufferSize = 16 * 1024;
38 40
39 enum { 41 enum {
40 kStatusError = -3, 42 kStatusError = -3,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 OnResolved(result); 76 OnResolved(result);
75 } 77 }
76 78
77 void OnResolved(int result) { 79 void OnResolved(int result) {
78 if (result < 0) { 80 if (result < 0) {
79 SelfDestruct(); 81 SelfDestruct();
80 return; 82 return;
81 } 83 }
82 84
83 host_socket_.reset(new net::TCPClientSocket(address_list_, nullptr, nullptr, 85 host_socket_.reset(new net::TCPClientSocket(address_list_, nullptr, nullptr,
84 net::NetLog::Source())); 86 net::NetLogSource()));
85 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, 87 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected,
86 base::Unretained(this))); 88 base::Unretained(this)));
87 if (result != net::ERR_IO_PENDING) 89 if (result != net::ERR_IO_PENDING)
88 OnConnected(result); 90 OnConnected(result);
89 } 91 }
90 92
91 void OnConnected(int result) { 93 void OnConnected(int result) {
92 if (result < 0) { 94 if (result < 0) {
93 SelfDestruct(); 95 SelfDestruct();
94 return; 96 return;
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (!forwarding_map_.empty()) 491 if (!forwarding_map_.empty())
490 UpdateConnections(); 492 UpdateConnections();
491 else 493 else
492 CloseAllConnections(); 494 CloseAllConnections();
493 } 495 }
494 496
495 void PortForwardingController::UpdateConnections() { 497 void PortForwardingController::UpdateConnections() {
496 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) 498 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it)
497 it->second->UpdateForwardingMap(forwarding_map_); 499 it->second->UpdateForwardingMap(forwarding_map_);
498 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698