OLD | NEW |
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 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 bool IsTCPFastOpenUserEnabled() { | 133 bool IsTCPFastOpenUserEnabled() { |
134 return g_tcp_fastopen_user_enabled; | 134 return g_tcp_fastopen_user_enabled; |
135 } | 135 } |
136 | 136 |
137 // This is asynchronous because it needs to do file IO, and it isn't allowed to | 137 // This is asynchronous because it needs to do file IO, and it isn't allowed to |
138 // do that on the IO thread. | 138 // do that on the IO thread. |
139 void CheckSupportAndMaybeEnableTCPFastOpen(bool user_enabled) { | 139 void CheckSupportAndMaybeEnableTCPFastOpen(bool user_enabled) { |
140 #if defined(OS_LINUX) || defined(OS_ANDROID) | 140 #if defined(OS_LINUX) || defined(OS_ANDROID) |
141 base::PostTaskWithTraitsAndReplyWithResult( | 141 base::PostTaskWithTraitsAndReplyWithResult( |
142 FROM_HERE, base::TaskTraits().MayBlock().WithShutdownBehavior( | 142 FROM_HERE, |
143 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), | 143 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, |
144 base::Bind(SystemSupportsTCPFastOpen), | 144 base::Bind(SystemSupportsTCPFastOpen), |
145 base::Bind(RegisterTCPFastOpenIntentAndSupport, user_enabled)); | 145 base::Bind(RegisterTCPFastOpenIntentAndSupport, user_enabled)); |
146 #endif | 146 #endif |
147 } | 147 } |
148 | 148 |
149 TCPSocketPosix::TCPSocketPosix( | 149 TCPSocketPosix::TCPSocketPosix( |
150 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 150 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
151 NetLog* net_log, | 151 NetLog* net_log, |
152 const NetLogSource& source) | 152 const NetLogSource& source) |
153 : socket_performance_watcher_(std::move(socket_performance_watcher)), | 153 : socket_performance_watcher_(std::move(socket_performance_watcher)), |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 if (info.tcpi_rtt > 0) { | 830 if (info.tcpi_rtt > 0) { |
831 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt); | 831 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt); |
832 return true; | 832 return true; |
833 } | 833 } |
834 } | 834 } |
835 #endif // defined(TCP_INFO) | 835 #endif // defined(TCP_INFO) |
836 return false; | 836 return false; |
837 } | 837 } |
838 | 838 |
839 } // namespace net | 839 } // namespace net |
OLD | NEW |