| Index: google_apis/gcm/monitoring/gcm_stats_recorder_impl.h
|
| diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder.h b/google_apis/gcm/monitoring/gcm_stats_recorder_impl.h
|
| similarity index 42%
|
| copy from google_apis/gcm/monitoring/gcm_stats_recorder.h
|
| copy to google_apis/gcm/monitoring/gcm_stats_recorder_impl.h
|
| index 45cf5fc978c3f46a66750ec349c6d41b07c5ad34..565f54287bb0f617997d8d56b79d8c04ef8036ee 100644
|
| --- a/google_apis/gcm/monitoring/gcm_stats_recorder.h
|
| +++ b/google_apis/gcm/monitoring/gcm_stats_recorder_impl.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef GOOGLE_APIS_GCM_GCM_STATS_RECORDER_H_
|
| -#define GOOGLE_APIS_GCM_GCM_STATS_RECORDER_H_
|
| +#ifndef GOOGLE_APIS_GCM_GCM_STATS_RECORDER_IMPL_H_
|
| +#define GOOGLE_APIS_GCM_GCM_STATS_RECORDER_IMPL_H_
|
|
|
| #include <deque>
|
| #include <string>
|
| @@ -16,6 +16,7 @@
|
| #include "google_apis/gcm/engine/registration_request.h"
|
| #include "google_apis/gcm/engine/unregistration_request.h"
|
| #include "google_apis/gcm/gcm_activity.h"
|
| +#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
|
|
|
| namespace gcm {
|
|
|
| @@ -24,27 +25,19 @@ namespace gcm {
|
| // by default.
|
| // This class is not thread safe. It is meant to be owned by a gcm client
|
| // instance.
|
| -class GCM_EXPORT GCMStatsRecorder {
|
| +class GCM_EXPORT GCMStatsRecorderImpl : public GCMStatsRecorder {
|
| public:
|
| - // Type of a received message
|
| - enum ReceivedMessageType {
|
| - // Data message.
|
| - DATA_MESSAGE,
|
| - // Message that indicates some messages have been deleted on the server.
|
| - DELETED_MESSAGES,
|
| - };
|
| -
|
| - // A delegate interface that allows the GCMStatsRecorder instance to interact
|
| - // with its container.
|
| + // A delegate interface that allows the GCMStatsRecorderImpl instance to
|
| + // interact with its container.
|
| class Delegate {
|
| public:
|
| - // Called when the GCMStatsRecorder is recording activities and a new
|
| + // Called when the GCMStatsRecorderImpl is recording activities and a new
|
| // activity has just been recorded.
|
| virtual void OnActivityRecorded() = 0;
|
| };
|
|
|
| - GCMStatsRecorder();
|
| - virtual ~GCMStatsRecorder();
|
| + GCMStatsRecorderImpl();
|
| + virtual ~GCMStatsRecorderImpl();
|
|
|
| // Indicates whether the recorder is currently recording activities or not.
|
| bool is_recording() const {
|
| @@ -60,95 +53,53 @@ class GCM_EXPORT GCMStatsRecorder {
|
| // Clear all recorded activities.
|
| void Clear();
|
|
|
| - // All RecordXXXX methods below will record one activity. It will be inserted
|
| - // to the front of a queue so that entries in the queue had reverse
|
| - // chronological order.
|
| -
|
| - // Records that a check-in has been initiated.
|
| - void RecordCheckinInitiated(uint64 android_id);
|
| -
|
| - // Records that a check-in has been delayed due to backoff.
|
| - void RecordCheckinDelayedDueToBackoff(int64 delay_msec);
|
| -
|
| - // Records that a check-in request has succeeded.
|
| - void RecordCheckinSuccess();
|
| -
|
| - // Records that a check-in request has failed. If a retry will be tempted then
|
| - // will_retry should be true.
|
| - void RecordCheckinFailure(std::string status, bool will_retry);
|
| -
|
| - // Records that a connection to MCS has been initiated.
|
| - void RecordConnectionInitiated(const std::string& host);
|
| -
|
| - // Records that a connection has been delayed due to backoff.
|
| - void RecordConnectionDelayedDueToBackoff(int64 delay_msec);
|
| -
|
| - // Records that connection has been successfully established.
|
| - void RecordConnectionSuccess();
|
| -
|
| - // Records that connection has failed with a network error code.
|
| - void RecordConnectionFailure(int network_error);
|
| -
|
| - // Records that connection reset has been signaled.
|
| - void RecordConnectionResetSignaled(
|
| - ConnectionFactory::ConnectionResetReason reason);
|
| -
|
| - // Records that a registration request has been sent. This could be initiated
|
| - // directly from API, or from retry logic.
|
| - void RecordRegistrationSent(const std::string& app_id,
|
| - const std::string& sender_ids);
|
| -
|
| - // Records that a registration response has been received from server.
|
| - void RecordRegistrationResponse(const std::string& app_id,
|
| - const std::vector<std::string>& sender_ids,
|
| - RegistrationRequest::Status status);
|
| -
|
| - // Records that a registration retry has been requested. The actual retry
|
| - // action may not occur until some time later according to backoff logic.
|
| - void RecordRegistrationRetryRequested(
|
| + // GCMStatsRecorder implementation:
|
| + virtual void RecordCheckinInitiated(uint64 android_id) OVERRIDE;
|
| + virtual void RecordCheckinDelayedDueToBackoff(int64 delay_msec) OVERRIDE;
|
| + virtual void RecordCheckinSuccess() OVERRIDE;
|
| + virtual void RecordCheckinFailure(std::string status,
|
| + bool will_retry) OVERRIDE;
|
| + virtual void RecordConnectionInitiated(const std::string& host) OVERRIDE;
|
| + virtual void RecordConnectionDelayedDueToBackoff(int64 delay_msec) OVERRIDE;
|
| + virtual void RecordConnectionSuccess() OVERRIDE;
|
| + virtual void RecordConnectionFailure(int network_error) OVERRIDE;
|
| + virtual void RecordConnectionResetSignaled(
|
| + ConnectionFactory::ConnectionResetReason reason) OVERRIDE;
|
| + virtual void RecordRegistrationSent(const std::string& app_id,
|
| + const std::string& sender_ids) OVERRIDE;
|
| + virtual void RecordRegistrationResponse(
|
| const std::string& app_id,
|
| const std::vector<std::string>& sender_ids,
|
| - int retries_left);
|
| -
|
| - // Records that an unregistration request has been sent. This could be
|
| - // initiated directly from API, or from retry logic.
|
| - void RecordUnregistrationSent(const std::string& app_id);
|
| -
|
| - // Records that an unregistration response has been received from server.
|
| - void RecordUnregistrationResponse(const std::string& app_id,
|
| - UnregistrationRequest::Status status);
|
| -
|
| - // Records that an unregistration retry has been requested and delayed due to
|
| - // backoff logic.
|
| - void RecordUnregistrationRetryDelayed(const std::string& app_id,
|
| - int64 delay_msec);
|
| -
|
| - // Records that a data message has been received. If this message is not
|
| - // sent to a registered app, to_registered_app shoudl be false. If it
|
| - // indicates that a message has been dropped on the server, is_message_dropped
|
| - // should be true.
|
| - void RecordDataMessageReceived(const std::string& app_id,
|
| - const std::string& from,
|
| - int message_byte_size,
|
| - bool to_registered_app,
|
| - ReceivedMessageType message_type);
|
| -
|
| - // Records that an outgoing data message was sent over the wire.
|
| - void RecordDataSentToWire(const std::string& app_id,
|
| - const std::string& receiver_id,
|
| - const std::string& message_id,
|
| - int queued);
|
| - // Records that the MCS client sent a 'send status' notification to callback.
|
| - void RecordNotifySendStatus(const std::string& app_id,
|
| - const std::string& receiver_id,
|
| - const std::string& message_id,
|
| - MCSClient::MessageSendStatus status,
|
| - int byte_size,
|
| - int ttl);
|
| - // Records that a 'send error' message was received.
|
| - void RecordIncomingSendError(const std::string& app_id,
|
| - const std::string& receiver_id,
|
| - const std::string& message_id);
|
| + RegistrationRequest::Status status) OVERRIDE;
|
| + virtual void RecordRegistrationRetryRequested(
|
| + const std::string& app_id,
|
| + const std::vector<std::string>& sender_ids,
|
| + int retries_left) OVERRIDE;
|
| + virtual void RecordUnregistrationSent(const std::string& app_id) OVERRIDE;
|
| + virtual void RecordUnregistrationResponse(
|
| + const std::string& app_id,
|
| + UnregistrationRequest::Status status) OVERRIDE;
|
| + virtual void RecordUnregistrationRetryDelayed(const std::string& app_id,
|
| + int64 delay_msec) OVERRIDE;
|
| + virtual void RecordDataMessageReceived(
|
| + const std::string& app_id,
|
| + const std::string& from,
|
| + int message_byte_size,
|
| + bool to_registered_app,
|
| + ReceivedMessageType message_type) OVERRIDE;
|
| + virtual void RecordDataSentToWire(const std::string& app_id,
|
| + const std::string& receiver_id,
|
| + const std::string& message_id,
|
| + int queued) OVERRIDE;
|
| + virtual void RecordNotifySendStatus(const std::string& app_id,
|
| + const std::string& receiver_id,
|
| + const std::string& message_id,
|
| + MCSClient::MessageSendStatus status,
|
| + int byte_size,
|
| + int ttl) OVERRIDE;
|
| + virtual void RecordIncomingSendError(const std::string& app_id,
|
| + const std::string& receiver_id,
|
| + const std::string& message_id) OVERRIDE;
|
|
|
| // Collect all recorded activities into the struct.
|
| void CollectActivities(RecordedActivities* recorder_activities) const;
|
| @@ -206,9 +157,9 @@ class GCM_EXPORT GCMStatsRecorder {
|
| std::deque<ReceivingActivity> receiving_activities_;
|
| std::deque<SendingActivity> sending_activities_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorder);
|
| + DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderImpl);
|
| };
|
|
|
| } // namespace gcm
|
|
|
| -#endif // GOOGLE_APIS_GCM_GCM_STATS_RECORDER_H_
|
| +#endif // GOOGLE_APIS_GCM_GCM_STATS_RECORDER_IMPL_H_
|
|
|