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

Side by Side Diff: components/gcm_driver/gcm_stats_recorder_android.h

Issue 1515153003: Enable chrome://gcm-internals on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
7
8 #include <deque>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "components/gcm_driver/gcm_activity.h"
13
14 namespace gcm {
15
16 class RecordedActivities;
17
18 // Stats recorder for Android, used for recording stats and activities on the
19 // GCM Driver level for debugging purposes. Based on the GCMStatsRecorder, as
20 // defined in the GCM Engine, which does not exist on Android.
21 class GCMStatsRecorderAndroid {
22 public:
23 // A delegate interface that allows the GCMStatsRecorderAndroid instance to
24 // interact with its container.
25 class Delegate {
Bernhard Bauer 2015/12/18 19:07:07 Maybe something for a followup, but consider repla
Peter Beverloo 2015/12/21 13:09:44 Ack, I'll follow up for both implementations.
26 public:
27 // Called when the GCMStatsRecorderAndroid is recording activities and a new
28 // activity has just been recorded.
29 virtual void OnActivityRecorded() = 0;
30 };
31
32 explicit GCMStatsRecorderAndroid(Delegate* delegate);
Bernhard Bauer 2015/12/18 19:07:07 Can you specify the ownership of |delegate| in a c
Peter Beverloo 2015/12/21 13:09:44 Done.
33 ~GCMStatsRecorderAndroid();
34
35 // Clears the recorded activities.
36 void Clear();
37
38 // Collects all recorded activities into |*recorded_activities|.
39 void CollectActivities(RecordedActivities* recorded_activities) const;
40
41 // Records that a registration for |app_id| has been sent.
42 void RecordRegistrationSent(const std::string& app_id);
43
44 // Records that the registration sent for |app_id| has received a response.
45 // |success| indicates whether the registration was successful.
46 void RecordRegistrationResponse(const std::string& app_id, bool success);
47
48 // Records that an unregistration for |app_id| has been sent.
49 void RecordUnregistrationSent(const std::string& app_id);
50
51 // Records that the unregistration sent for |app_id| has received a response.
52 // |success| indicates whether the unregistration was successful.
53 void RecordUnregistrationResponse(const std::string& app_id, bool success);
54
55 // Records that a data message has been received for |app_id|.
56 void RecordDataMessageReceived(const std::string& app_id,
57 int message_byte_size);
58
59 bool is_recording() const { return is_recording_; }
60 void set_is_recording(bool recording) { is_recording_ = recording; }
61
62 private:
63 void RecordRegistration(const std::string& app_id,
64 const std::string& event,
65 const std::string& details);
66
67 // Delegate made available by the container. May be a nullptr.
68 Delegate* delegate_;
69
70 // Toggle determining whether the recorder is recording.
71 bool is_recording_ = false;
72
73 // Recorded registration activities (which includes unregistrations).
74 std::deque<RegistrationActivity> registration_activities_;
75
76 // Recorded received message activities.
77 std::deque<ReceivingActivity> receiving_activities_;
78
79 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderAndroid);
80 };
81
82 } // namespace gcm
83
84 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.cc ('k') | components/gcm_driver/gcm_stats_recorder_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698