summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 01:35:01 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 01:35:01 +0000
commit5da9380c7854a095cdb8388575ea1a93fa1def6f (patch)
tree61e6f835b12840961c8b796303fc672a2cfd1b7b /google_apis
parente90f4a7ba319c021416cc6b2cbdd05e20927f1ca (diff)
downloadchromium_src-5da9380c7854a095cdb8388575ea1a93fa1def6f.zip
chromium_src-5da9380c7854a095cdb8388575ea1a93fa1def6f.tar.gz
chromium_src-5da9380c7854a095cdb8388575ea1a93fa1def6f.tar.bz2
Move all gcm activity types out of GCMStatsRecorder
This is needed to remove dependency on GCMStatsRecorder from GCMClient. BUG=356716 TEST=existing tests TBR=arv@chromium.org Review URL: https://codereview.chromium.org/294053017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/gcm/gcm.gyp2
-rw-r--r--google_apis/gcm/gcm_activity.cc53
-rw-r--r--google_apis/gcm/gcm_activity.h80
-rw-r--r--google_apis/gcm/gcm_client.h5
-rw-r--r--google_apis/gcm/monitoring/gcm_stats_recorder.cc44
-rw-r--r--google_apis/gcm/monitoring/gcm_stats_recorder.h63
-rw-r--r--google_apis/gcm/monitoring/gcm_stats_recorder_unittest.cc10
7 files changed, 144 insertions, 113 deletions
diff --git a/google_apis/gcm/gcm.gyp b/google_apis/gcm/gcm.gyp
index ba9bf0c..33365f0 100644
--- a/google_apis/gcm/gcm.gyp
+++ b/google_apis/gcm/gcm.gyp
@@ -69,6 +69,8 @@
'engine/registration_request.h',
'engine/unregistration_request.cc',
'engine/unregistration_request.h',
+ 'gcm_activity.cc',
+ 'gcm_activity.h',
'gcm_client.cc',
'gcm_client.h',
'gcm_client_impl.cc',
diff --git a/google_apis/gcm/gcm_activity.cc b/google_apis/gcm/gcm_activity.cc
new file mode 100644
index 0000000..4c04d37
--- /dev/null
+++ b/google_apis/gcm/gcm_activity.cc
@@ -0,0 +1,53 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "google_apis/gcm/gcm_activity.h"
+
+namespace gcm {
+
+Activity::Activity()
+ : time(base::Time::Now()) {
+}
+
+Activity::~Activity() {
+}
+
+CheckinActivity::CheckinActivity() {
+}
+
+CheckinActivity::~CheckinActivity() {
+}
+
+ConnectionActivity::ConnectionActivity() {
+}
+
+ConnectionActivity::~ConnectionActivity() {
+}
+
+RegistrationActivity::RegistrationActivity() {
+}
+
+RegistrationActivity::~RegistrationActivity() {
+}
+
+ReceivingActivity::ReceivingActivity()
+ : message_byte_size(0) {
+}
+
+ReceivingActivity::~ReceivingActivity() {
+}
+
+SendingActivity::SendingActivity() {
+}
+
+SendingActivity::~SendingActivity() {
+}
+
+RecordedActivities::RecordedActivities() {
+}
+
+RecordedActivities::~RecordedActivities() {
+}
+
+} // namespace gcm
diff --git a/google_apis/gcm/gcm_activity.h b/google_apis/gcm/gcm_activity.h
new file mode 100644
index 0000000..45078c7
--- /dev/null
+++ b/google_apis/gcm/gcm_activity.h
@@ -0,0 +1,80 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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_ACTIVITY_H_
+#define GOOGLE_APIS_GCM_GCM_ACTIVITY_H_
+
+#include <string>
+#include <vector>
+
+#include "base/time/time.h"
+#include "google_apis/gcm/base/gcm_export.h"
+
+namespace gcm {
+
+// Contains data that are common to all activity kinds below.
+struct GCM_EXPORT Activity {
+ Activity();
+ virtual ~Activity();
+
+ base::Time time;
+ std::string event; // A short description of the event.
+ std::string details; // Any additional detail about the event.
+};
+
+// Contains relevant data of a connection activity.
+struct GCM_EXPORT ConnectionActivity : Activity {
+ ConnectionActivity();
+ virtual ~ConnectionActivity();
+};
+
+// Contains relevant data of a check-in activity.
+struct GCM_EXPORT CheckinActivity : Activity {
+ CheckinActivity();
+ virtual ~CheckinActivity();
+};
+
+// Contains relevant data of a registration/unregistration step.
+struct GCM_EXPORT RegistrationActivity : Activity {
+ RegistrationActivity();
+ virtual ~RegistrationActivity();
+
+ std::string app_id;
+ std::string sender_ids; // Comma separated sender ids.
+};
+
+// Contains relevant data of a message receiving event.
+struct GCM_EXPORT ReceivingActivity : Activity {
+ ReceivingActivity();
+ virtual ~ReceivingActivity();
+
+ std::string app_id;
+ std::string from;
+ int message_byte_size;
+};
+
+// Contains relevant data of a send-message step.
+struct GCM_EXPORT SendingActivity : Activity {
+ SendingActivity();
+ virtual ~SendingActivity();
+
+ std::string app_id;
+ std::string receiver_id;
+ std::string message_id;
+};
+
+struct GCM_EXPORT RecordedActivities {
+ RecordedActivities();
+ virtual ~RecordedActivities();
+
+ std::vector<CheckinActivity> checkin_activities;
+ std::vector<ConnectionActivity> connection_activities;
+ std::vector<RegistrationActivity> registration_activities;
+ std::vector<ReceivingActivity> receiving_activities;
+ std::vector<SendingActivity> sending_activities;
+};
+
+} // namespace gcm
+
+#endif // GOOGLE_APIS_GCM_GCM_ACTIVITY_H_
diff --git a/google_apis/gcm/gcm_client.h b/google_apis/gcm/gcm_client.h
index 02111c8..119bb38 100644
--- a/google_apis/gcm/gcm_client.h
+++ b/google_apis/gcm/gcm_client.h
@@ -10,8 +10,9 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "google_apis/gcm/base/gcm_export.h"
-#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
+#include "google_apis/gcm/gcm_activity.h"
template <class T> class scoped_refptr;
@@ -134,7 +135,7 @@ class GCM_EXPORT GCMClient {
int send_queue_size;
int resend_queue_size;
- GCMStatsRecorder::RecordedActivities recorded_activities;
+ RecordedActivities recorded_activities;
};
// A delegate interface that allows the GCMClient instance to interact with
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder.cc b/google_apis/gcm/monitoring/gcm_stats_recorder.cc
index d08c611..f6c3e0f 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder.cc
+++ b/google_apis/gcm/monitoring/gcm_stats_recorder.cc
@@ -140,50 +140,6 @@ std::string GetUnregistrationStatusString(
} // namespace
-GCMStatsRecorder::Activity::Activity()
- : time(base::Time::Now()) {
-}
-
-GCMStatsRecorder::Activity::~Activity() {
-}
-
-GCMStatsRecorder::CheckinActivity::CheckinActivity() {
-}
-
-GCMStatsRecorder::CheckinActivity::~CheckinActivity() {
-}
-
-GCMStatsRecorder::ConnectionActivity::ConnectionActivity() {
-}
-
-GCMStatsRecorder::ConnectionActivity::~ConnectionActivity() {
-}
-
-GCMStatsRecorder::RegistrationActivity::RegistrationActivity() {
-}
-
-GCMStatsRecorder::RegistrationActivity::~RegistrationActivity() {
-}
-
-GCMStatsRecorder::ReceivingActivity::ReceivingActivity()
- : message_byte_size(0) {
-}
-
-GCMStatsRecorder::ReceivingActivity::~ReceivingActivity() {
-}
-
-GCMStatsRecorder::SendingActivity::SendingActivity() {
-}
-
-GCMStatsRecorder::SendingActivity::~SendingActivity() {
-}
-
-GCMStatsRecorder::RecordedActivities::RecordedActivities() {
-}
-
-GCMStatsRecorder::RecordedActivities::~RecordedActivities() {
-}
-
GCMStatsRecorder::GCMStatsRecorder() : is_recording_(false), delegate_(NULL) {
}
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder.h b/google_apis/gcm/monitoring/gcm_stats_recorder.h
index bc2afb2..45cf5fc 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder.h
+++ b/google_apis/gcm/monitoring/gcm_stats_recorder.h
@@ -15,6 +15,7 @@
#include "google_apis/gcm/engine/mcs_client.h"
#include "google_apis/gcm/engine/registration_request.h"
#include "google_apis/gcm/engine/unregistration_request.h"
+#include "google_apis/gcm/gcm_activity.h"
namespace gcm {
@@ -33,68 +34,6 @@ class GCM_EXPORT GCMStatsRecorder {
DELETED_MESSAGES,
};
- // Contains data that are common to all activity kinds below.
- struct GCM_EXPORT Activity {
- Activity();
- virtual ~Activity();
-
- base::Time time;
- std::string event; // A short description of the event.
- std::string details; // Any additional detail about the event.
- };
-
- // Contains relevant data of a connection activity.
- struct GCM_EXPORT ConnectionActivity : Activity {
- ConnectionActivity();
- virtual ~ConnectionActivity();
- };
-
- // Contains relevant data of a check-in activity.
- struct GCM_EXPORT CheckinActivity : Activity {
- CheckinActivity();
- virtual ~CheckinActivity();
- };
-
- // Contains relevant data of a registration/unregistration step.
- struct GCM_EXPORT RegistrationActivity : Activity {
- RegistrationActivity();
- virtual ~RegistrationActivity();
-
- std::string app_id;
- std::string sender_ids; // Comma separated sender ids.
- };
-
- // Contains relevant data of a message receiving event.
- struct GCM_EXPORT ReceivingActivity : Activity {
- ReceivingActivity();
- virtual ~ReceivingActivity();
-
- std::string app_id;
- std::string from;
- int message_byte_size;
- };
-
- // Contains relevant data of a send-message step.
- struct GCM_EXPORT SendingActivity : Activity {
- SendingActivity();
- virtual ~SendingActivity();
-
- std::string app_id;
- std::string receiver_id;
- std::string message_id;
- };
-
- struct GCM_EXPORT RecordedActivities {
- RecordedActivities();
- virtual ~RecordedActivities();
-
- std::vector<GCMStatsRecorder::CheckinActivity> checkin_activities;
- std::vector<GCMStatsRecorder::ConnectionActivity> connection_activities;
- std::vector<GCMStatsRecorder::RegistrationActivity> registration_activities;
- std::vector<GCMStatsRecorder::ReceivingActivity> receiving_activities;
- std::vector<GCMStatsRecorder::SendingActivity> sending_activities;
- };
-
// A delegate interface that allows the GCMStatsRecorder instance to interact
// with its container.
class Delegate {
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder_unittest.cc b/google_apis/gcm/monitoring/gcm_stats_recorder_unittest.cc
index c9256c7..c8756ec 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder_unittest.cc
+++ b/google_apis/gcm/monitoring/gcm_stats_recorder_unittest.cc
@@ -286,7 +286,7 @@ class GCMStatsRecorderTest : public testing::Test {
protected:
void VerifyCheckin(
- const std::deque<GCMStatsRecorder::CheckinActivity>& queue,
+ const std::deque<CheckinActivity>& queue,
const std::string& event,
const std::string& details,
const std::string& remark) {
@@ -295,7 +295,7 @@ class GCMStatsRecorderTest : public testing::Test {
}
void VerifyConnection(
- const std::deque<GCMStatsRecorder::ConnectionActivity>& queue,
+ const std::deque<ConnectionActivity>& queue,
const std::string& event,
const std::string& details,
const std::string& remark) {
@@ -304,7 +304,7 @@ class GCMStatsRecorderTest : public testing::Test {
}
void VerifyRegistration(
- const std::deque<GCMStatsRecorder::RegistrationActivity>& queue,
+ const std::deque<RegistrationActivity>& queue,
const std::string& sender_ids,
const std::string& event,
const std::string& details,
@@ -316,7 +316,7 @@ class GCMStatsRecorderTest : public testing::Test {
}
void VerifyReceivingData(
- const std::deque<GCMStatsRecorder::ReceivingActivity>& queue,
+ const std::deque<ReceivingActivity>& queue,
const std::string& event,
const std::string& details,
const std::string& remark) {
@@ -328,7 +328,7 @@ class GCMStatsRecorderTest : public testing::Test {
}
void VerifySendingData(
- const std::deque<GCMStatsRecorder::SendingActivity>& queue,
+ const std::deque<SendingActivity>& queue,
const std::string& event, const std::string& details,
const std::string& remark) {
EXPECT_EQ(kAppId, queue.front().app_id) << remark;