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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_ 6 #define COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "components/gcm_driver/gcm_activity.h" 13 #include "components/gcm_driver/gcm_activity.h"
14 #include "google_apis/gcm/engine/connection_factory.h" 14 #include "google_apis/gcm/engine/connection_factory.h"
15 #include "google_apis/gcm/engine/mcs_client.h" 15 #include "google_apis/gcm/engine/mcs_client.h"
16 #include "google_apis/gcm/engine/registration_request.h" 16 #include "google_apis/gcm/engine/registration_request.h"
17 #include "google_apis/gcm/engine/unregistration_request.h" 17 #include "google_apis/gcm/engine/unregistration_request.h"
18 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" 18 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
19 19
20 namespace gcm { 20 namespace gcm {
21 21
22 // Records GCM internal stats and activities for debugging purpose. Recording 22 // Records GCM internal stats and activities for debugging purpose. Recording
23 // can be turned on/off by calling SetRecording(...) function. It is turned off 23 // can be turned on/off by calling SetRecording(...) function. It is turned off
24 // by default. 24 // by default.
25 // This class is not thread safe. It is meant to be owned by a gcm client 25 // This class is not thread safe. It is meant to be owned by a gcm client
26 // instance. 26 // instance.
27 class GCMStatsRecorderImpl : public GCMStatsRecorder { 27 class GCMStatsRecorderImpl : public GCMStatsRecorder {
28 public: 28 public:
29 GCMStatsRecorderImpl(); 29 GCMStatsRecorderImpl();
30 virtual ~GCMStatsRecorderImpl(); 30 ~GCMStatsRecorderImpl() override;
31 31
32 // Indicates whether the recorder is currently recording activities or not. 32 // Indicates whether the recorder is currently recording activities or not.
33 bool is_recording() const { 33 bool is_recording() const {
34 return is_recording_; 34 return is_recording_;
35 } 35 }
36 36
37 // Turns recording on/off. 37 // Turns recording on/off.
38 void SetRecording(bool recording); 38 void SetRecording(bool recording);
39 39
40 // Set a delegate to receive callback from the recorder. 40 // Set a delegate to receive callback from the recorder.
41 void SetDelegate(Delegate* delegate); 41 void SetDelegate(Delegate* delegate);
42 42
43 // Clear all recorded activities. 43 // Clear all recorded activities.
44 void Clear(); 44 void Clear();
45 45
46 // GCMStatsRecorder implementation: 46 // GCMStatsRecorder implementation:
47 virtual void RecordCheckinInitiated(uint64 android_id) override; 47 void RecordCheckinInitiated(uint64 android_id) override;
48 virtual void RecordCheckinDelayedDueToBackoff(int64 delay_msec) override; 48 void RecordCheckinDelayedDueToBackoff(int64 delay_msec) override;
49 virtual void RecordCheckinSuccess() override; 49 void RecordCheckinSuccess() override;
50 virtual void RecordCheckinFailure(std::string status, 50 void RecordCheckinFailure(std::string status, bool will_retry) override;
51 bool will_retry) override; 51 void RecordConnectionInitiated(const std::string& host) override;
52 virtual void RecordConnectionInitiated(const std::string& host) override; 52 void RecordConnectionDelayedDueToBackoff(int64 delay_msec) override;
53 virtual void RecordConnectionDelayedDueToBackoff(int64 delay_msec) override; 53 void RecordConnectionSuccess() override;
54 virtual void RecordConnectionSuccess() override; 54 void RecordConnectionFailure(int network_error) override;
55 virtual void RecordConnectionFailure(int network_error) override; 55 void RecordConnectionResetSignaled(
56 virtual void RecordConnectionResetSignaled(
57 ConnectionFactory::ConnectionResetReason reason) override; 56 ConnectionFactory::ConnectionResetReason reason) override;
58 virtual void RecordRegistrationSent(const std::string& app_id, 57 void RecordRegistrationSent(const std::string& app_id,
59 const std::string& sender_ids) override; 58 const std::string& sender_ids) override;
60 virtual void RecordRegistrationResponse( 59 void RecordRegistrationResponse(const std::string& app_id,
61 const std::string& app_id, 60 const std::vector<std::string>& sender_ids,
62 const std::vector<std::string>& sender_ids, 61 RegistrationRequest::Status status) override;
63 RegistrationRequest::Status status) override; 62 void RecordRegistrationRetryRequested(
64 virtual void RecordRegistrationRetryRequested(
65 const std::string& app_id, 63 const std::string& app_id,
66 const std::vector<std::string>& sender_ids, 64 const std::vector<std::string>& sender_ids,
67 int retries_left) override; 65 int retries_left) override;
68 virtual void RecordUnregistrationSent(const std::string& app_id) override; 66 void RecordUnregistrationSent(const std::string& app_id) override;
69 virtual void RecordUnregistrationResponse( 67 void RecordUnregistrationResponse(
70 const std::string& app_id, 68 const std::string& app_id,
71 UnregistrationRequest::Status status) override; 69 UnregistrationRequest::Status status) override;
72 virtual void RecordUnregistrationRetryDelayed(const std::string& app_id, 70 void RecordUnregistrationRetryDelayed(const std::string& app_id,
73 int64 delay_msec) override; 71 int64 delay_msec) override;
74 virtual void RecordDataMessageReceived( 72 void RecordDataMessageReceived(const std::string& app_id,
75 const std::string& app_id, 73 const std::string& from,
76 const std::string& from, 74 int message_byte_size,
77 int message_byte_size, 75 bool to_registered_app,
78 bool to_registered_app, 76 ReceivedMessageType message_type) override;
79 ReceivedMessageType message_type) override; 77 void RecordDataSentToWire(const std::string& app_id,
80 virtual void RecordDataSentToWire(const std::string& app_id, 78 const std::string& receiver_id,
81 const std::string& receiver_id, 79 const std::string& message_id,
82 const std::string& message_id, 80 int queued) override;
83 int queued) override; 81 void RecordNotifySendStatus(const std::string& app_id,
84 virtual void RecordNotifySendStatus(const std::string& app_id, 82 const std::string& receiver_id,
85 const std::string& receiver_id, 83 const std::string& message_id,
86 const std::string& message_id, 84 MCSClient::MessageSendStatus status,
87 MCSClient::MessageSendStatus status, 85 int byte_size,
88 int byte_size, 86 int ttl) override;
89 int ttl) override; 87 void RecordIncomingSendError(const std::string& app_id,
90 virtual void RecordIncomingSendError(const std::string& app_id, 88 const std::string& receiver_id,
91 const std::string& receiver_id, 89 const std::string& message_id) override;
92 const std::string& message_id) override;
93 90
94 // Collect all recorded activities into the struct. 91 // Collect all recorded activities into the struct.
95 void CollectActivities(RecordedActivities* recorder_activities) const; 92 void CollectActivities(RecordedActivities* recorder_activities) const;
96 93
97 const std::deque<CheckinActivity>& checkin_activities() const { 94 const std::deque<CheckinActivity>& checkin_activities() const {
98 return checkin_activities_; 95 return checkin_activities_;
99 } 96 }
100 const std::deque<ConnectionActivity>& connection_activities() const { 97 const std::deque<ConnectionActivity>& connection_activities() const {
101 return connection_activities_; 98 return connection_activities_;
102 } 99 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 base::TimeTicks last_received_data_message_burst_start_time_; 150 base::TimeTicks last_received_data_message_burst_start_time_;
154 base::TimeTicks last_received_data_message_time_within_burst_; 151 base::TimeTicks last_received_data_message_time_within_burst_;
155 int64 received_data_message_burst_size_; 152 int64 received_data_message_burst_size_;
156 153
157 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderImpl); 154 DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderImpl);
158 }; 155 };
159 156
160 } // namespace gcm 157 } // namespace gcm
161 158
162 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_ 159 #endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_
OLDNEW
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop_unittest.cc ('k') | components/gcm_driver/system_encryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698