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

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: Created 4 years, 1 month 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..5db53838002125bae796203d278836fc796c4dce 100644
--- a/google_apis/gcm/engine/connection_factory_impl.h
+++ b/google_apis/gcm/engine/connection_factory_impl.h
@@ -9,6 +9,8 @@
#include <stddef.h>
+#include <google/protobuf/repeated_field.h>
+
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
@@ -22,6 +24,10 @@
#include "net/socket/client_socket_handle.h"
#include "url/gurl.h"
+namespace mcs_proto {
+class ClientEvent;
+}
+
namespace net {
class HttpNetworkSession;
class NetLog;
@@ -79,11 +85,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.
@@ -112,11 +116,22 @@ class GCM_EXPORT ConnectionFactoryImpl :
// ConnectionHandler callback for connection issues.
void ConnectionHandlerCallback(int result);
+ // Connection attempts since the last successful connection.
+ google::protobuf::RepeatedPtrField<mcs_proto::ClientEvent> client_events_;
+
+ // Current connection attempt.
+ mcs_proto::ClientEvent current_event_;
+
private:
// Helper method for checking backoff and triggering a connection as
// necessary.
void ConnectWithBackoff();
+ // Implementation of Connect(..). If not in backoff, uses |login_request_|
+ // in attempting a connection/handshake. On connection/handshake failure, goes
+ // into backoff.
+ void ConnectImpl();
+
// Proxy resolution and connection functions.
void OnProxyResolveDone(int status);
void OnProxyConnectDone(int status);
@@ -199,6 +214,13 @@ class GCM_EXPORT ConnectionFactoryImpl :
// Listener for connection change events.
ConnectionListener* listener_;
+ // The total number of ClientEvents which are currently buffered.
+ int total_client_events_ = -1;
+
+ // The state of the network when last updated.
+ net::NetworkChangeNotifier::ConnectionType network_type_ =
+ net::NetworkChangeNotifier::CONNECTION_NONE;
+
base::WeakPtrFactory<ConnectionFactoryImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ConnectionFactoryImpl);
« no previous file with comments | « no previous file | google_apis/gcm/engine/connection_factory_impl.cc » ('j') | google_apis/gcm/engine/connection_factory_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698