OLD | NEW |
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 "net/socket/client_socket_pool_base.h" | 5 #include "net/socket/client_socket_pool_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
20 #include "base/values.h" | 20 #include "base/values.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "net/log/net_log.h" | 22 #include "net/log/net_log.h" |
23 #include "net/log/net_log_event_type.h" | 23 #include "net/log/net_log_event_type.h" |
| 24 #include "net/log/net_log_source.h" |
24 | 25 |
25 using base::TimeDelta; | 26 using base::TimeDelta; |
26 | 27 |
27 namespace net { | 28 namespace net { |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 // Indicate whether or not we should establish a new transport layer connection | 32 // Indicate whether or not we should establish a new transport layer connection |
32 // after a certain timeout has passed without receiving an ACK. | 33 // after a certain timeout has passed without receiving an ACK. |
33 bool g_connect_backup_jobs_enabled = true; | 34 bool g_connect_backup_jobs_enabled = true; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 LoadTimingInfo::ConnectTiming(), request.handle(), idle_time, | 499 LoadTimingInfo::ConnectTiming(), request.handle(), idle_time, |
499 group, request.net_log()); | 500 group, request.net_log()); |
500 return true; | 501 return true; |
501 } | 502 } |
502 | 503 |
503 return false; | 504 return false; |
504 } | 505 } |
505 | 506 |
506 // static | 507 // static |
507 void ClientSocketPoolBaseHelper::LogBoundConnectJobToRequest( | 508 void ClientSocketPoolBaseHelper::LogBoundConnectJobToRequest( |
508 const NetLog::Source& connect_job_source, const Request& request) { | 509 const NetLogSource& connect_job_source, |
| 510 const Request& request) { |
509 request.net_log().AddEvent(NetLogEventType::SOCKET_POOL_BOUND_TO_CONNECT_JOB, | 511 request.net_log().AddEvent(NetLogEventType::SOCKET_POOL_BOUND_TO_CONNECT_JOB, |
510 connect_job_source.ToEventParametersCallback()); | 512 connect_job_source.ToEventParametersCallback()); |
511 } | 513 } |
512 | 514 |
513 void ClientSocketPoolBaseHelper::CancelRequest( | 515 void ClientSocketPoolBaseHelper::CancelRequest( |
514 const std::string& group_name, ClientSocketHandle* handle) { | 516 const std::string& group_name, ClientSocketHandle* handle) { |
515 PendingCallbackMap::iterator callback_it = pending_callback_map_.find(handle); | 517 PendingCallbackMap::iterator callback_it = pending_callback_map_.find(handle); |
516 if (callback_it != pending_callback_map_.end()) { | 518 if (callback_it != pending_callback_map_.end()) { |
517 int result = callback_it->second.result; | 519 int result = callback_it->second.result; |
518 pending_callback_map_.erase(callback_it); | 520 pending_callback_map_.erase(callback_it); |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 // If there are no more requests, kill the backup timer. | 1329 // If there are no more requests, kill the backup timer. |
1328 if (pending_requests_.empty()) | 1330 if (pending_requests_.empty()) |
1329 backup_job_timer_.Stop(); | 1331 backup_job_timer_.Stop(); |
1330 request->CrashIfInvalid(); | 1332 request->CrashIfInvalid(); |
1331 return request; | 1333 return request; |
1332 } | 1334 } |
1333 | 1335 |
1334 } // namespace internal | 1336 } // namespace internal |
1335 | 1337 |
1336 } // namespace net | 1338 } // namespace net |
OLD | NEW |