summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/services/gcm/gcm_driver.cc1
-rw-r--r--chrome/browser/ui/webui/gcm_internals_ui.cc25
-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
9 files changed, 155 insertions, 128 deletions
diff --git a/chrome/browser/services/gcm/gcm_driver.cc b/chrome/browser/services/gcm/gcm_driver.cc
index 50ca9dc..3578042 100644
--- a/chrome/browser/services/gcm/gcm_driver.cc
+++ b/chrome/browser/services/gcm/gcm_driver.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/sequenced_task_runner.h"
diff --git a/chrome/browser/ui/webui/gcm_internals_ui.cc b/chrome/browser/ui/webui/gcm_internals_ui.cc
index 7f63acc..84a6ec8 100644
--- a/chrome/browser/ui/webui/gcm_internals_ui.cc
+++ b/chrome/browser/ui/webui/gcm_internals_ui.cc
@@ -28,10 +28,9 @@
namespace {
void SetCheckinInfo(
- const std::vector<gcm::GCMStatsRecorder::CheckinActivity>& checkins,
+ const std::vector<gcm::CheckinActivity>& checkins,
base::ListValue* checkin_info) {
- std::vector<gcm::GCMStatsRecorder::CheckinActivity>::const_iterator it =
- checkins.begin();
+ std::vector<gcm::CheckinActivity>::const_iterator it = checkins.begin();
for (; it < checkins.end(); ++it) {
base::ListValue* row = new base::ListValue();
checkin_info->Append(row);
@@ -43,10 +42,9 @@ void SetCheckinInfo(
}
void SetConnectionInfo(
- const std::vector<gcm::GCMStatsRecorder::ConnectionActivity>& connections,
+ const std::vector<gcm::ConnectionActivity>& connections,
base::ListValue* connection_info) {
- std::vector<gcm::GCMStatsRecorder::ConnectionActivity>::const_iterator it =
- connections.begin();
+ std::vector<gcm::ConnectionActivity>::const_iterator it = connections.begin();
for (; it < connections.end(); ++it) {
base::ListValue* row = new base::ListValue();
connection_info->Append(row);
@@ -58,10 +56,9 @@ void SetConnectionInfo(
}
void SetRegistrationInfo(
- const std::vector<gcm::GCMStatsRecorder::RegistrationActivity>&
- registrations,
+ const std::vector<gcm::RegistrationActivity>& registrations,
base::ListValue* registration_info) {
- std::vector<gcm::GCMStatsRecorder::RegistrationActivity>::const_iterator it =
+ std::vector<gcm::RegistrationActivity>::const_iterator it =
registrations.begin();
for (; it < registrations.end(); ++it) {
base::ListValue* row = new base::ListValue();
@@ -76,10 +73,9 @@ void SetRegistrationInfo(
}
void SetReceivingInfo(
- const std::vector<gcm::GCMStatsRecorder::ReceivingActivity>& receives,
+ const std::vector<gcm::ReceivingActivity>& receives,
base::ListValue* receive_info) {
- std::vector<gcm::GCMStatsRecorder::ReceivingActivity>::const_iterator it =
- receives.begin();
+ std::vector<gcm::ReceivingActivity>::const_iterator it = receives.begin();
for (; it < receives.end(); ++it) {
base::ListValue* row = new base::ListValue();
receive_info->Append(row);
@@ -94,10 +90,9 @@ void SetReceivingInfo(
}
void SetSendingInfo(
- const std::vector<gcm::GCMStatsRecorder::SendingActivity>& sends,
+ const std::vector<gcm::SendingActivity>& sends,
base::ListValue* send_info) {
- std::vector<gcm::GCMStatsRecorder::SendingActivity>::const_iterator it =
- sends.begin();
+ std::vector<gcm::SendingActivity>::const_iterator it = sends.begin();
for (; it < sends.end(); ++it) {
base::ListValue* row = new base::ListValue();
send_info->Append(row);
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;