OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "google_apis/gcm/engine/connection_factory_impl.h" | 5 #include "google_apis/gcm/engine/connection_factory_impl.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/profiler/scoped_tracker.h" |
10 #include "google_apis/gcm/engine/connection_handler_impl.h" | 11 #include "google_apis/gcm/engine/connection_handler_impl.h" |
11 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" | 12 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" |
12 #include "google_apis/gcm/protocol/mcs.pb.h" | 13 #include "google_apis/gcm/protocol/mcs.pb.h" |
13 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "net/http/http_network_session.h" | 16 #include "net/http/http_network_session.h" |
16 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
17 #include "net/proxy/proxy_info.h" | 18 #include "net/proxy/proxy_info.h" |
18 #include "net/socket/client_socket_handle.h" | 19 #include "net/socket/client_socket_handle.h" |
19 #include "net/socket/client_socket_pool_manager.h" | 20 #include "net/socket/client_socket_pool_manager.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 read_callback, | 336 read_callback, |
336 write_callback, | 337 write_callback, |
337 connection_callback)); | 338 connection_callback)); |
338 } | 339 } |
339 | 340 |
340 base::TimeTicks ConnectionFactoryImpl::NowTicks() { | 341 base::TimeTicks ConnectionFactoryImpl::NowTicks() { |
341 return base::TimeTicks::Now(); | 342 return base::TimeTicks::Now(); |
342 } | 343 } |
343 | 344 |
344 void ConnectionFactoryImpl::OnConnectDone(int result) { | 345 void ConnectionFactoryImpl::OnConnectDone(int result) { |
| 346 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455884 is fixed. |
| 347 tracked_objects::ScopedTracker tracking_profile( |
| 348 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 349 "455884 ConnectionFactoryImpl::OnConnectDone")); |
345 if (result != net::OK) { | 350 if (result != net::OK) { |
346 // If the connection fails, try another proxy. | 351 // If the connection fails, try another proxy. |
347 result = ReconsiderProxyAfterError(result); | 352 result = ReconsiderProxyAfterError(result); |
348 // ReconsiderProxyAfterError either returns an error (in which case it is | 353 // ReconsiderProxyAfterError either returns an error (in which case it is |
349 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering | 354 // not reconsidering a proxy) or returns ERR_IO_PENDING if it is considering |
350 // another proxy. | 355 // another proxy. |
351 DCHECK_NE(result, net::OK); | 356 DCHECK_NE(result, net::OK); |
352 if (result == net::ERR_IO_PENDING) | 357 if (result == net::ERR_IO_PENDING) |
353 return; // Proxy reconsideration pending. Return. | 358 return; // Proxy reconsideration pending. Return. |
354 LOG(ERROR) << "Failed to connect to MCS endpoint with error " << result; | 359 LOG(ERROR) << "Failed to connect to MCS endpoint with error " << result; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 567 |
563 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { | 568 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { |
564 if (!http_network_session_.get() || !http_network_session_->http_auth_cache()) | 569 if (!http_network_session_.get() || !http_network_session_->http_auth_cache()) |
565 return; | 570 return; |
566 | 571 |
567 gcm_network_session_->http_auth_cache()->UpdateAllFrom( | 572 gcm_network_session_->http_auth_cache()->UpdateAllFrom( |
568 *http_network_session_->http_auth_cache()); | 573 *http_network_session_->http_auth_cache()); |
569 } | 574 } |
570 | 575 |
571 } // namespace gcm | 576 } // namespace gcm |
OLD | NEW |