Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: google_apis/gcm/monitoring/gcm_stats_recorder.h

Issue 266913015: Enable auto-refreshing of the gcm-internals page whenever a GCM activity is recorded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing nicolas's comments and merge changes. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « google_apis/gcm/gcm_client_impl_unittest.cc ('k') | google_apis/gcm/monitoring/gcm_stats_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/monitoring/gcm_stats_recorder.h
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder.h b/google_apis/gcm/monitoring/gcm_stats_recorder.h
index ffee1aec1552692f285389a6ac759d3e145a9063..bc2afb228b233b3c46d1c89ff246a88b7875d029 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder.h
+++ b/google_apis/gcm/monitoring/gcm_stats_recorder.h
@@ -95,6 +95,15 @@ class GCM_EXPORT GCMStatsRecorder {
std::vector<GCMStatsRecorder::SendingActivity> sending_activities;
};
+ // A delegate interface that allows the GCMStatsRecorder instance to interact
+ // with its container.
+ class Delegate {
+ public:
+ // Called when the GCMStatsRecorder is recording activities and a new
+ // activity has just been recorded.
+ virtual void OnActivityRecorded() = 0;
+ };
+
GCMStatsRecorder();
virtual ~GCMStatsRecorder();
@@ -106,6 +115,9 @@ class GCM_EXPORT GCMStatsRecorder {
// Turns recording on/off.
void SetRecording(bool recording);
+ // Set a delegate to receive callback from the recorder.
+ void SetDelegate(Delegate* delegate);
+
// Clear all recorded activities.
void Clear();
@@ -219,19 +231,27 @@ class GCM_EXPORT GCMStatsRecorder {
}
protected:
+ // Notify the recorder delegate, if it exists, that an activity has been
+ // recorded.
+ void NotifyActivityRecorded();
+
void RecordCheckin(const std::string& event,
const std::string& details);
+
void RecordConnection(const std::string& event,
const std::string& details);
+
void RecordRegistration(const std::string& app_id,
const std::string& sender_id,
const std::string& event,
const std::string& details);
+
void RecordReceiving(const std::string& app_id,
const std::string& from,
int message_byte_size,
const std::string& event,
const std::string& details);
+
void RecordSending(const std::string& app_id,
const std::string& receiver_id,
const std::string& message_id,
@@ -239,6 +259,7 @@ class GCM_EXPORT GCMStatsRecorder {
const std::string& details);
bool is_recording_;
+ Delegate* delegate_;
std::deque<CheckinActivity> checkin_activities_;
std::deque<ConnectionActivity> connection_activities_;
« no previous file with comments | « google_apis/gcm/gcm_client_impl_unittest.cc ('k') | google_apis/gcm/monitoring/gcm_stats_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698