| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "google_apis/gcm/base/gcm_export.h" | 9 #include "google_apis/gcm/base/gcm_export.h" |
| 10 #include "google_apis/gcm/engine/connection_handler.h" | 10 #include "google_apis/gcm/engine/connection_handler.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 typedef base::Callback<void(mcs_proto::LoginRequest* login_request)> | 23 typedef base::Callback<void(mcs_proto::LoginRequest* login_request)> |
| 24 BuildLoginRequestCallback; | 24 BuildLoginRequestCallback; |
| 25 | 25 |
| 26 // Reasons for triggering a connection reset. Note that these enums are | 26 // Reasons for triggering a connection reset. Note that these enums are |
| 27 // consumed by a histogram, so ordering should not be modified. | 27 // consumed by a histogram, so ordering should not be modified. |
| 28 enum ConnectionResetReason { | 28 enum ConnectionResetReason { |
| 29 LOGIN_FAILURE, // Login response included an error. | 29 LOGIN_FAILURE, // Login response included an error. |
| 30 CLOSE_COMMAND, // Received a close command. | 30 CLOSE_COMMAND, // Received a close command. |
| 31 HEARTBEAT_FAILURE, // Heartbeat was not acknowledged in time. | 31 HEARTBEAT_FAILURE, // Heartbeat was not acknowledged in time. |
| 32 SOCKET_FAILURE, // net::Socket error. | 32 SOCKET_FAILURE, // net::Socket error. |
| 33 NETWORK_CHANGE, // NetworkChangeNotifier notified of a network change. |
| 33 // Count of total number of connection reset reasons. All new reset reasons | 34 // Count of total number of connection reset reasons. All new reset reasons |
| 34 // should be added above this line. | 35 // should be added above this line. |
| 35 CONNECTION_RESET_COUNT, | 36 CONNECTION_RESET_COUNT, |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 ConnectionFactory(); | 39 ConnectionFactory(); |
| 39 virtual ~ConnectionFactory(); | 40 virtual ~ConnectionFactory(); |
| 40 | 41 |
| 41 // Initialize the factory, creating a connection handler with a disconnected | 42 // Initialize the factory, creating a connection handler with a disconnected |
| 42 // socket. Should only be called once. | 43 // socket. Should only be called once. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 73 // Manually reset the connection. This can occur if an application specific | 74 // Manually reset the connection. This can occur if an application specific |
| 74 // event forced a reset (e.g. server sends a close connection response). | 75 // event forced a reset (e.g. server sends a close connection response). |
| 75 // If the last connection was made within kConnectionResetWindowSecs, the old | 76 // If the last connection was made within kConnectionResetWindowSecs, the old |
| 76 // backoff is restored, else a new backoff kicks off. | 77 // backoff is restored, else a new backoff kicks off. |
| 77 virtual void SignalConnectionReset(ConnectionResetReason reason) = 0; | 78 virtual void SignalConnectionReset(ConnectionResetReason reason) = 0; |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace gcm | 81 } // namespace gcm |
| 81 | 82 |
| 82 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_H_ | 83 #endif // GOOGLE_APIS_GCM_ENGINE_CONNECTION_FACTORY_H_ |
| OLD | NEW |