| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MONITORING_GCM_STATS_RECORDER_H_ | 5 #ifndef GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ |
| 6 #define GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ | 6 #define GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 12 #include "google_apis/gcm/base/gcm_export.h" | 14 #include "google_apis/gcm/base/gcm_export.h" |
| 13 #include "google_apis/gcm/engine/connection_factory.h" | 15 #include "google_apis/gcm/engine/connection_factory.h" |
| 14 #include "google_apis/gcm/engine/mcs_client.h" | 16 #include "google_apis/gcm/engine/mcs_client.h" |
| 15 #include "google_apis/gcm/engine/registration_request.h" | 17 #include "google_apis/gcm/engine/registration_request.h" |
| 16 #include "google_apis/gcm/engine/unregistration_request.h" | 18 #include "google_apis/gcm/engine/unregistration_request.h" |
| 17 | 19 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 public: | 37 public: |
| 36 // Called when the GCMStatsRecorderImpl is recording activities and a new | 38 // Called when the GCMStatsRecorderImpl is recording activities and a new |
| 37 // activity has just been recorded. | 39 // activity has just been recorded. |
| 38 virtual void OnActivityRecorded() = 0; | 40 virtual void OnActivityRecorded() = 0; |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 GCMStatsRecorder() {} | 43 GCMStatsRecorder() {} |
| 42 virtual ~GCMStatsRecorder() {} | 44 virtual ~GCMStatsRecorder() {} |
| 43 | 45 |
| 44 // Records that a check-in has been initiated. | 46 // Records that a check-in has been initiated. |
| 45 virtual void RecordCheckinInitiated(uint64 android_id) = 0; | 47 virtual void RecordCheckinInitiated(uint64_t android_id) = 0; |
| 46 | 48 |
| 47 // Records that a check-in has been delayed due to backoff. | 49 // Records that a check-in has been delayed due to backoff. |
| 48 virtual void RecordCheckinDelayedDueToBackoff(int64 delay_msec) = 0; | 50 virtual void RecordCheckinDelayedDueToBackoff(int64_t delay_msec) = 0; |
| 49 | 51 |
| 50 // Records that a check-in request has succeeded. | 52 // Records that a check-in request has succeeded. |
| 51 virtual void RecordCheckinSuccess() = 0; | 53 virtual void RecordCheckinSuccess() = 0; |
| 52 | 54 |
| 53 // Records that a check-in request has failed. If a retry will be tempted then | 55 // Records that a check-in request has failed. If a retry will be tempted then |
| 54 // will_retry should be true. | 56 // will_retry should be true. |
| 55 virtual void RecordCheckinFailure(const std::string& status, | 57 virtual void RecordCheckinFailure(const std::string& status, |
| 56 bool will_retry) = 0; | 58 bool will_retry) = 0; |
| 57 | 59 |
| 58 // Records that a connection to MCS has been initiated. | 60 // Records that a connection to MCS has been initiated. |
| 59 virtual void RecordConnectionInitiated(const std::string& host) = 0; | 61 virtual void RecordConnectionInitiated(const std::string& host) = 0; |
| 60 | 62 |
| 61 // Records that a connection has been delayed due to backoff. | 63 // Records that a connection has been delayed due to backoff. |
| 62 virtual void RecordConnectionDelayedDueToBackoff(int64 delay_msec) = 0; | 64 virtual void RecordConnectionDelayedDueToBackoff(int64_t delay_msec) = 0; |
| 63 | 65 |
| 64 // Records that connection has been successfully established. | 66 // Records that connection has been successfully established. |
| 65 virtual void RecordConnectionSuccess() = 0; | 67 virtual void RecordConnectionSuccess() = 0; |
| 66 | 68 |
| 67 // Records that connection has failed with a network error code. | 69 // Records that connection has failed with a network error code. |
| 68 virtual void RecordConnectionFailure(int network_error) = 0; | 70 virtual void RecordConnectionFailure(int network_error) = 0; |
| 69 | 71 |
| 70 // Records that connection reset has been signaled. | 72 // Records that connection reset has been signaled. |
| 71 virtual void RecordConnectionResetSignaled( | 73 virtual void RecordConnectionResetSignaled( |
| 72 ConnectionFactory::ConnectionResetReason reason) = 0; | 74 ConnectionFactory::ConnectionResetReason reason) = 0; |
| 73 | 75 |
| 74 // Records that a registration request has been sent. This could be initiated | 76 // Records that a registration request has been sent. This could be initiated |
| 75 // directly from API, or from retry logic. | 77 // directly from API, or from retry logic. |
| 76 virtual void RecordRegistrationSent(const std::string& app_id, | 78 virtual void RecordRegistrationSent(const std::string& app_id, |
| 77 const std::string& source) = 0; | 79 const std::string& source) = 0; |
| 78 | 80 |
| 79 // Records that a registration response has been received from server. | 81 // Records that a registration response has been received from server. |
| 80 virtual void RecordRegistrationResponse( | 82 virtual void RecordRegistrationResponse( |
| 81 const std::string& app_id, | 83 const std::string& app_id, |
| 82 const std::string& source, | 84 const std::string& source, |
| 83 RegistrationRequest::Status status) = 0; | 85 RegistrationRequest::Status status) = 0; |
| 84 | 86 |
| 85 // Records that a registration retry has been requested and delayed due to | 87 // Records that a registration retry has been requested and delayed due to |
| 86 // backoff logic. | 88 // backoff logic. |
| 87 virtual void RecordRegistrationRetryDelayed( | 89 virtual void RecordRegistrationRetryDelayed(const std::string& app_id, |
| 88 const std::string& app_id, | 90 const std::string& source, |
| 89 const std::string& source, | 91 int64_t delay_msec, |
| 90 int64 delay_msec, | 92 int retries_left) = 0; |
| 91 int retries_left) = 0; | |
| 92 | 93 |
| 93 // Records that an unregistration request has been sent. This could be | 94 // Records that an unregistration request has been sent. This could be |
| 94 // initiated directly from API, or from retry logic. | 95 // initiated directly from API, or from retry logic. |
| 95 virtual void RecordUnregistrationSent(const std::string& app_id, | 96 virtual void RecordUnregistrationSent(const std::string& app_id, |
| 96 const std::string& source) = 0; | 97 const std::string& source) = 0; |
| 97 | 98 |
| 98 // Records that an unregistration response has been received from server. | 99 // Records that an unregistration response has been received from server. |
| 99 virtual void RecordUnregistrationResponse( | 100 virtual void RecordUnregistrationResponse( |
| 100 const std::string& app_id, | 101 const std::string& app_id, |
| 101 const std::string& source, | 102 const std::string& source, |
| 102 UnregistrationRequest::Status status) = 0; | 103 UnregistrationRequest::Status status) = 0; |
| 103 | 104 |
| 104 // Records that an unregistration retry has been requested and delayed due to | 105 // Records that an unregistration retry has been requested and delayed due to |
| 105 // backoff logic. | 106 // backoff logic. |
| 106 virtual void RecordUnregistrationRetryDelayed(const std::string& app_id, | 107 virtual void RecordUnregistrationRetryDelayed(const std::string& app_id, |
| 107 const std::string& source, | 108 const std::string& source, |
| 108 int64 delay_msec, | 109 int64_t delay_msec, |
| 109 int retries_left) = 0; | 110 int retries_left) = 0; |
| 110 | 111 |
| 111 // Records that a data message has been received. If this message is not | 112 // Records that a data message has been received. If this message is not |
| 112 // sent to a registered app, to_registered_app shoudl be false. If it | 113 // sent to a registered app, to_registered_app shoudl be false. If it |
| 113 // indicates that a message has been dropped on the server, is_message_dropped | 114 // indicates that a message has been dropped on the server, is_message_dropped |
| 114 // should be true. | 115 // should be true. |
| 115 virtual void RecordDataMessageReceived(const std::string& app_id, | 116 virtual void RecordDataMessageReceived(const std::string& app_id, |
| 116 const std::string& from, | 117 const std::string& from, |
| 117 int message_byte_size, | 118 int message_byte_size, |
| 118 bool to_registered_app, | 119 bool to_registered_app, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 int ttl) = 0; | 133 int ttl) = 0; |
| 133 // Records that a 'send error' message was received. | 134 // Records that a 'send error' message was received. |
| 134 virtual void RecordIncomingSendError(const std::string& app_id, | 135 virtual void RecordIncomingSendError(const std::string& app_id, |
| 135 const std::string& receiver_id, | 136 const std::string& receiver_id, |
| 136 const std::string& message_id) = 0; | 137 const std::string& message_id) = 0; |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 } // namespace gcm | 140 } // namespace gcm |
| 140 | 141 |
| 141 #endif // GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ | 142 #endif // GOOGLE_APIS_GCM_MONITORING_GCM_STATS_RECORDER_H_ |
| OLD | NEW |