| Index: google_apis/gcm/engine/connection_factory_impl.cc
|
| diff --git a/google_apis/gcm/engine/connection_factory_impl.cc b/google_apis/gcm/engine/connection_factory_impl.cc
|
| index 67dab986357359282be3801f335d061de23c1f9d..20117b60db11abe01941b47bf1a56d813cc71f7e 100644
|
| --- a/google_apis/gcm/engine/connection_factory_impl.cc
|
| +++ b/google_apis/gcm/engine/connection_factory_impl.cc
|
| @@ -124,6 +124,10 @@ void ConnectionFactoryImpl::Connect() {
|
| ConnectWithBackoff();
|
| }
|
|
|
| +ConnectionEventTracker* ConnectionFactoryImpl::GetEventTrackerForTesting() {
|
| + return &event_tracker_;
|
| +}
|
| +
|
| void ConnectionFactoryImpl::ConnectWithBackoff() {
|
| // If a canary managed to connect while a backoff expiration was pending,
|
| // just cleanup the internal state.
|
| @@ -205,6 +209,10 @@ void ConnectionFactoryImpl::SignalConnectionReset(
|
| // connection.
|
| }
|
|
|
| + if (logging_in_)
|
| + event_tracker_.ConnectionLoginFailed();
|
| + event_tracker_.EndConnectionAttempt();
|
| +
|
| CloseSocket();
|
| DCHECK(!IsEndpointReachable());
|
|
|
| @@ -296,6 +304,11 @@ net::IPEndPoint ConnectionFactoryImpl::GetPeerIP() {
|
| }
|
|
|
| void ConnectionFactoryImpl::ConnectImpl() {
|
| + event_tracker_.StartConnectionAttempt();
|
| + StartConnection();
|
| +}
|
| +
|
| +void ConnectionFactoryImpl::StartConnection() {
|
| DCHECK(!IsEndpointReachable());
|
| // TODO(zea): Make this a dcheck again. crbug.com/462319
|
| CHECK(!socket_handle_.socket());
|
| @@ -326,6 +339,7 @@ void ConnectionFactoryImpl::InitHandler() {
|
| if (!request_builder_.is_null()) {
|
| request_builder_.Run(&login_request);
|
| DCHECK(login_request.IsInitialized());
|
| + event_tracker_.WriteToLoginRequest(&login_request);
|
| }
|
|
|
| connection_handler_->Init(login_request, socket_handle_.socket());
|
| @@ -371,6 +385,9 @@ void ConnectionFactoryImpl::OnConnectDone(int result) {
|
| backoff_entry_->InformOfRequest(false);
|
| UMA_HISTOGRAM_SPARSE_SLOWLY("GCM.ConnectionFailureErrorCode", result);
|
|
|
| + event_tracker_.ConnectionAttemptFailed(result);
|
| + event_tracker_.EndConnectionAttempt();
|
| +
|
| // If there are other endpoints available, use the next endpoint on the
|
| // subsequent retry.
|
| next_endpoint_++;
|
| @@ -419,6 +436,8 @@ void ConnectionFactoryImpl::ConnectionHandlerCallback(int result) {
|
| backoff_entry_->Reset();
|
| logging_in_ = false;
|
|
|
| + event_tracker_.ConnectionAttemptSucceeded();
|
| +
|
| if (listener_)
|
| listener_->OnConnected(GetCurrentEndpoint(), GetPeerIP());
|
| }
|
|
|