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 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/profiler/scoped_tracker.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
15 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
16 #include "net/dns/host_resolver.h" | 17 #include "net/dns/host_resolver.h" |
17 #include "net/dns/single_request_host_resolver.h" | 18 #include "net/dns/single_request_host_resolver.h" |
18 #include "net/socket/client_socket_pool.h" | 19 #include "net/socket/client_socket_pool.h" |
19 #include "net/socket/client_socket_pool_base.h" | 20 #include "net/socket/client_socket_pool_base.h" |
20 #include "net/socket/client_socket_pool_histograms.h" | 21 #include "net/socket/client_socket_pool_histograms.h" |
21 | 22 |
22 namespace net { | 23 namespace net { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 void TransportConnectJobHelper::SetOnIOComplete(T* job) { | 313 void TransportConnectJobHelper::SetOnIOComplete(T* job) { |
313 // These usages of base::Unretained() are safe because IO callbacks are | 314 // These usages of base::Unretained() are safe because IO callbacks are |
314 // guaranteed not to be called after the object is destroyed. | 315 // guaranteed not to be called after the object is destroyed. |
315 on_io_complete_ = base::Bind(&TransportConnectJobHelper::OnIOComplete<T>, | 316 on_io_complete_ = base::Bind(&TransportConnectJobHelper::OnIOComplete<T>, |
316 base::Unretained(this), | 317 base::Unretained(this), |
317 base::Unretained(job)); | 318 base::Unretained(job)); |
318 } | 319 } |
319 | 320 |
320 template <class T> | 321 template <class T> |
321 void TransportConnectJobHelper::OnIOComplete(T* job, int result) { | 322 void TransportConnectJobHelper::OnIOComplete(T* job, int result) { |
| 323 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 324 tracked_objects::ScopedTracker tracking_profile( |
| 325 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 326 "436634 TransportConnectJobHelper::OnIOComplete")); |
| 327 |
322 result = this->DoLoop(job, result); | 328 result = this->DoLoop(job, result); |
323 if (result != ERR_IO_PENDING) | 329 if (result != ERR_IO_PENDING) |
324 job->NotifyDelegateOfCompletion(result); // Deletes |job| and |this| | 330 job->NotifyDelegateOfCompletion(result); // Deletes |job| and |this| |
325 } | 331 } |
326 | 332 |
327 template <class T> | 333 template <class T> |
328 int TransportConnectJobHelper::DoLoop(T* job, int result) { | 334 int TransportConnectJobHelper::DoLoop(T* job, int result) { |
329 DCHECK_NE(next_state_, STATE_NONE); | 335 DCHECK_NE(next_state_, STATE_NONE); |
330 | 336 |
331 int rv = result; | 337 int rv = result; |
(...skipping 21 matching lines...) Expand all Loading... |
353 break; | 359 break; |
354 } | 360 } |
355 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 361 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
356 | 362 |
357 return rv; | 363 return rv; |
358 } | 364 } |
359 | 365 |
360 } // namespace net | 366 } // namespace net |
361 | 367 |
362 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ | 368 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |