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

Side by Side Diff: google_apis/gcm/gcm_client.h

Issue 202083005: Add activity recording capability to gcm internals page. User can refresh, start/stop recording, an… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_H_ 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_H_
6 #define GOOGLE_APIS_GCM_GCM_CLIENT_H_ 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "google_apis/gcm/base/gcm_export.h" 13 #include "google_apis/gcm/base/gcm_export.h"
14 #include "google_apis/gcm/gcm_stats_recorder.h"
14 15
15 template <class T> class scoped_refptr; 16 template <class T> class scoped_refptr;
16 17
17 namespace base { 18 namespace base {
18 class FilePath; 19 class FilePath;
19 class SequencedTaskRunner; 20 class SequencedTaskRunner;
20 } 21 }
21 22
22 namespace checkin_proto { 23 namespace checkin_proto {
23 class ChromeBuildProto; 24 class ChromeBuildProto;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 MessageData additional_data; 88 MessageData additional_data;
88 Result result; 89 Result result;
89 }; 90 };
90 91
91 // Internal states and activity statistics of a GCM client. 92 // Internal states and activity statistics of a GCM client.
92 struct GCM_EXPORT GCMStatistics { 93 struct GCM_EXPORT GCMStatistics {
93 public: 94 public:
94 GCMStatistics(); 95 GCMStatistics();
95 ~GCMStatistics(); 96 ~GCMStatistics();
96 97
98 bool is_recording;
97 bool gcm_client_created; 99 bool gcm_client_created;
98 std::string gcm_client_state; 100 std::string gcm_client_state;
99 bool connection_client_created; 101 bool connection_client_created;
100 std::string connection_state; 102 std::string connection_state;
101 uint64 android_id; 103 uint64 android_id;
104 std::string app_ids_cached;
105 int send_queue_size;
106 int unacked_queue_size;
107
108 std::vector<GCMStatsRecorder::CheckinActivity> checkins;
109 std::vector<GCMStatsRecorder::RegisterActivity> registers;
110 std::vector<GCMStatsRecorder::SendMessageActivity> sent_messages;
111 std::vector<GCMStatsRecorder::ReceiveMessageActivity> received_messages;
102 }; 112 };
103 113
104 // A delegate interface that allows the GCMClient instance to interact with 114 // A delegate interface that allows the GCMClient instance to interact with
105 // its caller, i.e. notifying asynchronous event. 115 // its caller, i.e. notifying asynchronous event.
106 class Delegate { 116 class Delegate {
107 public: 117 public:
108 // Called when the registration completed successfully or an error occurs. 118 // Called when the registration completed successfully or an error occurs.
109 // |app_id|: application ID. 119 // |app_id|: application ID.
110 // |registration_id|: non-empty if the registration completed successfully. 120 // |registration_id|: non-empty if the registration completed successfully.
111 // |result|: the type of the error if an error occured, success otherwise. 121 // |result|: the type of the error if an error occured, success otherwise.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 211
202 // Sends a message to a given receiver. Delegate::OnSendFinished will be 212 // Sends a message to a given receiver. Delegate::OnSendFinished will be
203 // called asynchronously upon completion. 213 // called asynchronously upon completion.
204 // |app_id|: application ID. 214 // |app_id|: application ID.
205 // |receiver_id|: registration ID of the receiver party. 215 // |receiver_id|: registration ID of the receiver party.
206 // |message|: message to be sent. 216 // |message|: message to be sent.
207 virtual void Send(const std::string& app_id, 217 virtual void Send(const std::string& app_id,
208 const std::string& receiver_id, 218 const std::string& receiver_id,
209 const OutgoingMessage& message) = 0; 219 const OutgoingMessage& message) = 0;
210 220
221 // Enables or disables internal activity recording.
222 virtual void SetRecording(bool recording) = 0;
fgorski 2014/03/18 21:28:37 Did you consider have SetRecording directly on the
juyik 2014/03/20 01:09:53 It is already on the recorder. I felt that recorde
223
224 // Clear all recorded GCM activity logs.
225 virtual void ClearActivityLogs() = 0;
226
211 // Gets internal states and statistics. 227 // Gets internal states and statistics.
212 virtual GCMStatistics GetStatistics() const = 0; 228 virtual GCMStatistics GetStatistics() const = 0;
213 }; 229 };
214 230
215 } // namespace gcm 231 } // namespace gcm
216 232
217 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ 233 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698