Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: google_apis/gcm/engine/connection_factory_impl.h

Issue 2481873002: Added ClientEvent proto and structure for storing events in the factory. (Closed)
Patch Set: Integrated code review comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « google_apis/gcm/engine/connection_event_tracker_unittest.cc ('k') | google_apis/gcm/engine/connection_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698