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

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 {
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);
33 ~GCMStatsRecorderAndroid();
34
35 void SetRecording(bool recording) { is_recording_ = recording; }
Nicolas Zea 2015/12/16 22:24:32 nit: Generally if you're going to inline this meth
Peter Beverloo 2015/12/17 17:08:24 Done.
36
37 bool is_recording() const { return is_recording_; }
38
39 void Clear();
40
41 // Collect all recorded activities into |*recorder_activities|.
42 void CollectActivities(RecordedActivities* recorder_activities) const;
43
44 void RecordRegistrationSent(const std::string& app_id);
Nicolas Zea 2015/12/16 22:24:32 nit: would be good to have comments for these meth
Peter Beverloo 2015/12/17 17:08:24 Done.
45 void RecordRegistrationResponse(const std::string& app_id, bool success);
46
47 void RecordUnregistrationSent(const std::string& app_id);
48 void RecordUnregistrationResponse(const std::string& app_id, bool success);
49
50 void RecordDataMessageReceived(const std::string& app_id,
51 int message_byte_size);
52
53 private:
54 void RecordRegistration(const std::string& app_id,
55 const std::string& event,
56 const std::string& details);
57
58 // Delegate made available by the container. May be a nullptr.
59 Delegate* delegate_;
60
61 // Toggle determining whether the recorder is recording.
62 bool is_recording_ = false;
63
64 // Recorded registration activities (which includes unregistrations).
65 std::deque<RegistrationActivity> registration_activities_;
66
67 // Recorded received message activities.
68 std::deque<ReceivingActivity> receiving_activities_;
69
70 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderAndroid);
71 };
72
73 } // namespace gcm
74
75 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698