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