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

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();
jianli 2015/12/18 00:10:00 nit: add virtual
Peter Beverloo 2015/12/18 17:19:16 Why? This class neither has a virtual base class,
34
35 bool is_recording() const { return is_recording_; }
jianli 2015/12/18 00:09:59 nit: move this getter and the setter below after m
Peter Beverloo 2015/12/18 17:19:16 Done. (Also for GCMStatsRecorderImpl, + Nicolas' S
36 void set_is_recording(bool recording) { is_recording_ = recording; }
37
38 void Clear();
jianli 2015/12/18 00:09:59 nit: comment this
Peter Beverloo 2015/12/18 17:19:17 Done.
39
40 // Collect all recorded activities into |*recorder_activities|.
jianli 2015/12/18 00:10:00 nit: Collect => Collects
Peter Beverloo 2015/12/18 17:19:16 Done.
41 void CollectActivities(RecordedActivities* recorder_activities) const;
jianli 2015/12/18 00:09:59 recorder => recorded
Peter Beverloo 2015/12/18 17:19:16 Done. (Also for GCMStatsRecorderImpl.)
42
43 // Records that a registration for |app_id| has been sent.
44 void RecordRegistrationSent(const std::string& app_id);
45
46 // Records that the registration sent for |app_id| has received a response.
47 // |success| indicates whether the registration was successful.
48 void RecordRegistrationResponse(const std::string& app_id, bool success);
49
50 // Records that an unregistration for |app_id| has been sent.
51 void RecordUnregistrationSent(const std::string& app_id);
52
53 // Records that the unregistration sent for |app_id| has received a response.
54 // |success| indicates whether the unregistration was successful.
55 void RecordUnregistrationResponse(const std::string& app_id, bool success);
56
57 // Records that a data message has been received for |app_id|.
58 void RecordDataMessageReceived(const std::string& app_id,
59 int message_byte_size);
60
61 private:
62 void RecordRegistration(const std::string& app_id,
63 const std::string& event,
64 const std::string& details);
65
66 // Delegate made available by the container. May be a nullptr.
67 Delegate* delegate_;
68
69 // Toggle determining whether the recorder is recording.
70 bool is_recording_ = false;
71
72 // Recorded registration activities (which includes unregistrations).
73 std::deque<RegistrationActivity> registration_activities_;
74
75 // Recorded received message activities.
76 std::deque<ReceivingActivity> receiving_activities_;
77
78 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderAndroid);
79 };
80
81 } // namespace gcm
82
83 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698