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