Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 if (!last_login_time_.is_null()) { | 202 if (!last_login_time_.is_null()) { |
| 203 UMA_HISTOGRAM_CUSTOM_TIMES("GCM.ConnectionUpTime", | 203 UMA_HISTOGRAM_CUSTOM_TIMES("GCM.ConnectionUpTime", |
| 204 NowTicks() - last_login_time_, | 204 NowTicks() - last_login_time_, |
| 205 base::TimeDelta::FromSeconds(1), | 205 base::TimeDelta::FromSeconds(1), |
| 206 base::TimeDelta::FromHours(24), | 206 base::TimeDelta::FromHours(24), |
| 207 50); | 207 50); |
| 208 // |last_login_time_| will be reset below, before attempting the new | 208 // |last_login_time_| will be reset below, before attempting the new |
| 209 // connection. | 209 // connection. |
| 210 } | 210 } |
| 211 | 211 |
| 212 if (logging_in_) | 212 // SignalConnectionReset can be called at any time without regard to whether |
| 213 event_tracker_.ConnectionLoginFailed(); | 213 // a connection attempt is currently in progress. Only notify the event |
| 214 event_tracker_.EndConnectionAttempt(); | 214 // tracker if there is an event in progress. |
| 215 if (event_tracker_.EventInProgress()) { | |
| 216 if (logging_in_) | |
|
Peter Beverloo
2017/01/12 16:03:27
note: this will need to merge with your reason ==
harkness
2017/01/16 12:20:37
Acknowledged.
| |
| 217 event_tracker_.ConnectionLoginFailed(); | |
| 218 event_tracker_.EndConnectionAttempt(); | |
| 219 } | |
| 215 | 220 |
| 216 CloseSocket(); | 221 CloseSocket(); |
| 217 DCHECK(!IsEndpointReachable()); | 222 DCHECK(!IsEndpointReachable()); |
| 218 | 223 |
| 219 // TODO(zea): if the network is offline, don't attempt to connect. | 224 // TODO(zea): if the network is offline, don't attempt to connect. |
| 220 // See crbug.com/396687 | 225 // See crbug.com/396687 |
| 221 | 226 |
| 222 // Network changes get special treatment as they can trigger a one-off canary | 227 // Network changes get special treatment as they can trigger a one-off canary |
| 223 // request that bypasses backoff (but does nothing if a connection is in | 228 // request that bypasses backoff (but does nothing if a connection is in |
| 224 // progress). Other connection reset events can be ignored as a connection | 229 // progress). Other connection reset events can be ignored as a connection |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 | 597 |
| 593 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { | 598 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { |
| 594 if (!http_network_session_ || !http_network_session_->http_auth_cache()) | 599 if (!http_network_session_ || !http_network_session_->http_auth_cache()) |
| 595 return; | 600 return; |
| 596 | 601 |
| 597 gcm_network_session_->http_auth_cache()->UpdateAllFrom( | 602 gcm_network_session_->http_auth_cache()->UpdateAllFrom( |
| 598 *http_network_session_->http_auth_cache()); | 603 *http_network_session_->http_auth_cache()); |
| 599 } | 604 } |
| 600 | 605 |
| 601 } // namespace gcm | 606 } // namespace gcm |
| OLD | NEW |