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

Side by Side Diff: net/socket/tcp_socket_posix.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/socket/tcp_socket.h" 5 #include "net/socket/tcp_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/tcp.h> 8 #include <netinet/tcp.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
16 #include "base/posix/eintr_wrapper.h" 16 #include "base/posix/eintr_wrapper.h"
17 #include "base/task_runner_util.h" 17 #include "base/task_runner_util.h"
18 #include "base/threading/worker_pool.h" 18 #include "base/threading/worker_pool.h"
19 #include "base/time/default_tick_clock.h" 19 #include "base/time/default_tick_clock.h"
20 #include "net/base/address_list.h" 20 #include "net/base/address_list.h"
21 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
22 #include "net/base/ip_endpoint.h" 22 #include "net/base/ip_endpoint.h"
23 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
24 #include "net/base/network_activity_monitor.h" 24 #include "net/base/network_activity_monitor.h"
25 #include "net/base/network_change_notifier.h" 25 #include "net/base/network_change_notifier.h"
26 #include "net/base/sockaddr_storage.h" 26 #include "net/base/sockaddr_storage.h"
27 #include "net/log/net_log.h"
27 #include "net/log/net_log_event_type.h" 28 #include "net/log/net_log_event_type.h"
29 #include "net/log/net_log_source.h"
28 #include "net/log/net_log_source_type.h" 30 #include "net/log/net_log_source_type.h"
29 #include "net/socket/socket_net_log_params.h" 31 #include "net/socket/socket_net_log_params.h"
30 #include "net/socket/socket_posix.h" 32 #include "net/socket/socket_posix.h"
31 33
32 // If we don't have a definition for TCPI_OPT_SYN_DATA, create one. 34 // If we don't have a definition for TCPI_OPT_SYN_DATA, create one.
33 #ifndef TCPI_OPT_SYN_DATA 35 #ifndef TCPI_OPT_SYN_DATA
34 #define TCPI_OPT_SYN_DATA 32 36 #define TCPI_OPT_SYN_DATA 32
35 #endif 37 #endif
36 38
37 namespace net { 39 namespace net {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 base::WorkerPool::GetTaskRunner(/*task_is_slow=*/false).get(), 136 base::WorkerPool::GetTaskRunner(/*task_is_slow=*/false).get(),
135 FROM_HERE, 137 FROM_HERE,
136 base::Bind(SystemSupportsTCPFastOpen), 138 base::Bind(SystemSupportsTCPFastOpen),
137 base::Bind(RegisterTCPFastOpenIntentAndSupport, user_enabled)); 139 base::Bind(RegisterTCPFastOpenIntentAndSupport, user_enabled));
138 #endif 140 #endif
139 } 141 }
140 142
141 TCPSocketPosix::TCPSocketPosix( 143 TCPSocketPosix::TCPSocketPosix(
142 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, 144 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher,
143 NetLog* net_log, 145 NetLog* net_log,
144 const NetLog::Source& source) 146 const NetLogSource& source)
145 : socket_performance_watcher_(std::move(socket_performance_watcher)), 147 : socket_performance_watcher_(std::move(socket_performance_watcher)),
146 tick_clock_(new base::DefaultTickClock()), 148 tick_clock_(new base::DefaultTickClock()),
147 rtt_notifications_minimum_interval_(base::TimeDelta::FromSeconds(1)), 149 rtt_notifications_minimum_interval_(base::TimeDelta::FromSeconds(1)),
148 use_tcp_fastopen_(false), 150 use_tcp_fastopen_(false),
149 tcp_fastopen_write_attempted_(false), 151 tcp_fastopen_write_attempted_(false),
150 tcp_fastopen_connected_(false), 152 tcp_fastopen_connected_(false),
151 tcp_fastopen_status_(TCP_FASTOPEN_STATUS_UNKNOWN), 153 tcp_fastopen_status_(TCP_FASTOPEN_STATUS_UNKNOWN),
152 logging_multiple_connect_attempts_(false), 154 logging_multiple_connect_attempts_(false),
153 net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::SOCKET)) { 155 net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::SOCKET)) {
154 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, 156 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE,
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 if (info.tcpi_rtt > 0) { 810 if (info.tcpi_rtt > 0) {
809 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt); 811 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt);
810 return true; 812 return true;
811 } 813 }
812 } 814 }
813 #endif // defined(TCP_INFO) 815 #endif // defined(TCP_INFO)
814 return false; 816 return false;
815 } 817 }
816 818
817 } // namespace net 819 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698