| 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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 CHECK(!ContainsKey(pending_callback_map_, handle)); | 1119 CHECK(!ContainsKey(pending_callback_map_, handle)); |
| 1120 pending_callback_map_[handle] = CallbackResultPair(callback, rv); | 1120 pending_callback_map_[handle] = CallbackResultPair(callback, rv); |
| 1121 base::MessageLoop::current()->PostTask( | 1121 base::MessageLoop::current()->PostTask( |
| 1122 FROM_HERE, | 1122 FROM_HERE, |
| 1123 base::Bind(&ClientSocketPoolBaseHelper::InvokeUserCallback, | 1123 base::Bind(&ClientSocketPoolBaseHelper::InvokeUserCallback, |
| 1124 weak_factory_.GetWeakPtr(), handle)); | 1124 weak_factory_.GetWeakPtr(), handle)); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 void ClientSocketPoolBaseHelper::InvokeUserCallback( | 1127 void ClientSocketPoolBaseHelper::InvokeUserCallback( |
| 1128 ClientSocketHandle* handle) { | 1128 ClientSocketHandle* handle) { |
| 1129 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455884 is fixed. |
| 1130 tracked_objects::ScopedTracker tracking_profile( |
| 1131 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1132 "455884 ClientSocketPoolBaseHelper::InvokeUserCallback")); |
| 1129 PendingCallbackMap::iterator it = pending_callback_map_.find(handle); | 1133 PendingCallbackMap::iterator it = pending_callback_map_.find(handle); |
| 1130 | 1134 |
| 1131 // Exit if the request has already been cancelled. | 1135 // Exit if the request has already been cancelled. |
| 1132 if (it == pending_callback_map_.end()) | 1136 if (it == pending_callback_map_.end()) |
| 1133 return; | 1137 return; |
| 1134 | 1138 |
| 1135 CHECK(!handle->is_initialized()); | 1139 CHECK(!handle->is_initialized()); |
| 1136 CompletionCallback callback = it->second.callback; | 1140 CompletionCallback callback = it->second.callback; |
| 1137 int result = it->second.result; | 1141 int result = it->second.result; |
| 1138 pending_callback_map_.erase(it); | 1142 pending_callback_map_.erase(it); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 pending_requests_.Erase(pointer); | 1332 pending_requests_.Erase(pointer); |
| 1329 // If there are no more requests, kill the backup timer. | 1333 // If there are no more requests, kill the backup timer. |
| 1330 if (pending_requests_.empty()) | 1334 if (pending_requests_.empty()) |
| 1331 backup_job_timer_.Stop(); | 1335 backup_job_timer_.Stop(); |
| 1332 return request.Pass(); | 1336 return request.Pass(); |
| 1333 } | 1337 } |
| 1334 | 1338 |
| 1335 } // namespace internal | 1339 } // namespace internal |
| 1336 | 1340 |
| 1337 } // namespace net | 1341 } // namespace net |
| OLD | NEW |