| Index: google_apis/gcm/engine/connection_factory_impl.h
|
| diff --git a/google_apis/gcm/engine/connection_factory_impl.h b/google_apis/gcm/engine/connection_factory_impl.h
|
| index 04c5e4f9c4b3b9b0085269b4ac573fc613b6d3d5..63d3e2e088b4ffe00bd9c17ad7509f27934ed5cb 100644
|
| --- a/google_apis/gcm/engine/connection_factory_impl.h
|
| +++ b/google_apis/gcm/engine/connection_factory_impl.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/time/time.h"
|
| +#include "google_apis/gcm/engine/connection_event_tracker.h"
|
| #include "google_apis/gcm/engine/connection_handler.h"
|
| #include "google_apis/gcm/protocol/mcs.pb.h"
|
| #include "net/base/backoff_entry.h"
|
| @@ -79,11 +80,9 @@ class GCM_EXPORT ConnectionFactoryImpl :
|
| net::IPEndPoint GetPeerIP();
|
|
|
| protected:
|
| - // Implementation of Connect(..). If not in backoff, uses |login_request_|
|
| - // in attempting a connection/handshake. On connection/handshake failure, goes
|
| - // into backoff.
|
| + // Initiate the connection to the GCM server.
|
| // Virtual for testing.
|
| - virtual void ConnectImpl();
|
| + virtual void StartConnection();
|
|
|
| // Helper method for initalizing the connection hander.
|
| // Virtual for testing.
|
| @@ -113,10 +112,18 @@ class GCM_EXPORT ConnectionFactoryImpl :
|
| void ConnectionHandlerCallback(int result);
|
|
|
| private:
|
| + friend class ConnectionFactoryImplTest;
|
| +
|
| + ConnectionEventTracker* GetEventTrackerForTesting();
|
| +
|
| // Helper method for checking backoff and triggering a connection as
|
| // necessary.
|
| void ConnectWithBackoff();
|
|
|
| + // Implementation of Connect(..). If not in backoff attempts a connection and
|
| + // handshake. On connection/handshake failure, goes into backoff.
|
| + void ConnectImpl();
|
| +
|
| // Proxy resolution and connection functions.
|
| void OnProxyResolveDone(int status);
|
| void OnProxyConnectDone(int status);
|
| @@ -130,6 +137,10 @@ class GCM_EXPORT ConnectionFactoryImpl :
|
| // Session's cache, if available.
|
| void RebuildNetworkSessionAuthCache();
|
|
|
| + // The tracker will maintain a list of all connection attempts with GCM,
|
| + // whether they succeeded, and their duration.
|
| + ConnectionEventTracker event_tracker_;
|
| +
|
| // The MCS endpoints to make connections to, sorted in order of priority.
|
| const std::vector<GURL> mcs_endpoints_;
|
| // Index to the endpoint for which a connection should be attempted next.
|
|
|