#include "components/gcm_driver/gcm_stats_recorder_impl.h"
#include "base/containers/circular_deque.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "components/gcm_driver/crypto/gcm_decryption_result.h"
#include "components/gcm_driver/crypto/gcm_encryption_provider.h"
#include "google_apis/gcm/engine/mcs_client.h"
#include "google_apis/gcm/engine/registration_request.h"
namespace gcm {
const uint32_t MAX_LOGGED_ACTIVITY_COUNT = …;
namespace {
template <typename T>
T* InsertCircularBuffer(base::circular_deque<T>* q, const T& item) { … }
std::string GetMessageSendStatusString(
gcm::MCSClient::MessageSendStatus status) { … }
std::string GetConnectionResetReasonString(
gcm::ConnectionFactory::ConnectionResetReason reason) { … }
std::string GetRegistrationStatusString(
gcm::RegistrationRequest::Status status) { … }
std::string GetUnregistrationStatusString(
gcm::UnregistrationRequest::Status status) { … }
}
GCMStatsRecorderImpl::GCMStatsRecorderImpl()
: … { … }
GCMStatsRecorderImpl::~GCMStatsRecorderImpl() = default;
void GCMStatsRecorderImpl::SetDelegate(Delegate* delegate) { … }
void GCMStatsRecorderImpl::Clear() { … }
void GCMStatsRecorderImpl::NotifyActivityRecorded() { … }
void GCMStatsRecorderImpl::RecordDecryptionFailure(const std::string& app_id,
GCMDecryptionResult result) { … }
void GCMStatsRecorderImpl::RecordCheckin(
const std::string& event,
const std::string& details) { … }
void GCMStatsRecorderImpl::RecordCheckinInitiated(uint64_t android_id) { … }
void GCMStatsRecorderImpl::RecordCheckinDelayedDueToBackoff(
int64_t delay_msec) { … }
void GCMStatsRecorderImpl::RecordCheckinSuccess() { … }
void GCMStatsRecorderImpl::RecordCheckinFailure(const std::string& status,
bool will_retry) { … }
void GCMStatsRecorderImpl::RecordConnection(
const std::string& event,
const std::string& details) { … }
void GCMStatsRecorderImpl::RecordConnectionInitiated(const std::string& host) { … }
void GCMStatsRecorderImpl::RecordConnectionDelayedDueToBackoff(
int64_t delay_msec) { … }
void GCMStatsRecorderImpl::RecordConnectionSuccess() { … }
void GCMStatsRecorderImpl::RecordConnectionFailure(int network_error) { … }
void GCMStatsRecorderImpl::RecordConnectionResetSignaled(
ConnectionFactory::ConnectionResetReason reason) { … }
void GCMStatsRecorderImpl::RecordRegistration(
const std::string& app_id,
const std::string& source,
const std::string& event,
const std::string& details) { … }
void GCMStatsRecorderImpl::RecordRegistrationSent(
const std::string& app_id,
const std::string& sender_ids) { … }
void GCMStatsRecorderImpl::RecordRegistrationResponse(
const std::string& app_id,
const std::string& source,
RegistrationRequest::Status status) { … }
void GCMStatsRecorderImpl::RecordRegistrationRetryDelayed(
const std::string& app_id,
const std::string& source,
int64_t delay_msec,
int retries_left) { … }
void GCMStatsRecorderImpl::RecordUnregistrationSent(const std::string& app_id,
const std::string& source) { … }
void GCMStatsRecorderImpl::RecordUnregistrationResponse(
const std::string& app_id,
const std::string& source,
UnregistrationRequest::Status status) { … }
void GCMStatsRecorderImpl::RecordUnregistrationRetryDelayed(
const std::string& app_id,
const std::string& source,
int64_t delay_msec,
int retries_left) { … }
void GCMStatsRecorderImpl::RecordReceiving(
const std::string& app_id,
const std::string& from,
int message_byte_size,
const std::string& event,
const std::string& details) { … }
void GCMStatsRecorderImpl::RecordDataMessageReceived(
const std::string& app_id,
const std::string& from,
int message_byte_size,
ReceivedMessageType message_type) { … }
void GCMStatsRecorderImpl::CollectActivities(
RecordedActivities* recorded_activities) const { … }
void GCMStatsRecorderImpl::RecordSending(const std::string& app_id,
const std::string& receiver_id,
const std::string& message_id,
const std::string& event,
const std::string& details) { … }
void GCMStatsRecorderImpl::RecordDataSentToWire(
const std::string& app_id,
const std::string& receiver_id,
const std::string& message_id,
int queued) { … }
void GCMStatsRecorderImpl::RecordNotifySendStatus(
const std::string& app_id,
const std::string& receiver_id,
const std::string& message_id,
gcm::MCSClient::MessageSendStatus status,
int byte_size,
int ttl) { … }
void GCMStatsRecorderImpl::RecordIncomingSendError(
const std::string& app_id,
const std::string& receiver_id,
const std::string& message_id) { … }
}