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

Side by Side Diff: google_apis/gcm/gcm_client_impl.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, 8 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
« no previous file with comments | « google_apis/gcm/gcm_client.cc ('k') | google_apis/gcm/gcm_client_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_IMPL_H_ 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_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/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "google_apis/gcm/base/mcs_message.h" 16 #include "google_apis/gcm/base/mcs_message.h"
17 #include "google_apis/gcm/engine/gcm_store.h" 17 #include "google_apis/gcm/engine/gcm_store.h"
18 #include "google_apis/gcm/engine/mcs_client.h" 18 #include "google_apis/gcm/engine/mcs_client.h"
19 #include "google_apis/gcm/engine/registration_request.h" 19 #include "google_apis/gcm/engine/registration_request.h"
20 #include "google_apis/gcm/engine/unregistration_request.h" 20 #include "google_apis/gcm/engine/unregistration_request.h"
21 #include "google_apis/gcm/gcm_client.h" 21 #include "google_apis/gcm/gcm_client.h"
22 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
23 #include "google_apis/gcm/protocol/android_checkin.pb.h"
22 #include "google_apis/gcm/protocol/checkin.pb.h" 24 #include "google_apis/gcm/protocol/checkin.pb.h"
23 #include "net/base/net_log.h" 25 #include "net/base/net_log.h"
24 #include "net/url_request/url_request_context_getter.h" 26 #include "net/url_request/url_request_context_getter.h"
25 27
26 class GURL; 28 class GURL;
27 29
28 namespace base { 30 namespace base {
29 class Clock; 31 class Clock;
30 } // namespace base 32 } // namespace base
31 33
34 namespace mcs_proto {
35 class DataMessageStanza;
36 } // namespace mcs_proto
37
32 namespace net { 38 namespace net {
33 class HttpNetworkSession; 39 class HttpNetworkSession;
34 } // namespace net 40 } // namespace net
35 41
36 namespace gcm { 42 namespace gcm {
37 43
38 class CheckinRequest; 44 class CheckinRequest;
39 class ConnectionFactory; 45 class ConnectionFactory;
40 class GCMClientImplTest; 46 class GCMClientImplTest;
41 47
42 // Helper class for building GCM internals. Allows tests to inject fake versions 48 // Helper class for building GCM internals. Allows tests to inject fake versions
43 // as necessary. 49 // as necessary.
44 class GCM_EXPORT GCMInternalsBuilder { 50 class GCM_EXPORT GCMInternalsBuilder {
45 public: 51 public:
46 GCMInternalsBuilder(); 52 GCMInternalsBuilder();
47 virtual ~GCMInternalsBuilder(); 53 virtual ~GCMInternalsBuilder();
48 54
49 virtual scoped_ptr<base::Clock> BuildClock(); 55 virtual scoped_ptr<base::Clock> BuildClock();
50 virtual scoped_ptr<MCSClient> BuildMCSClient( 56 virtual scoped_ptr<MCSClient> BuildMCSClient(
51 const std::string& version, 57 const std::string& version,
52 base::Clock* clock, 58 base::Clock* clock,
53 ConnectionFactory* connection_factory, 59 ConnectionFactory* connection_factory,
54 GCMStore* gcm_store); 60 GCMStore* gcm_store,
61 GCMStatsRecorder* recorder);
55 virtual scoped_ptr<ConnectionFactory> BuildConnectionFactory( 62 virtual scoped_ptr<ConnectionFactory> BuildConnectionFactory(
56 const std::vector<GURL>& endpoints, 63 const std::vector<GURL>& endpoints,
57 const net::BackoffEntry::Policy& backoff_policy, 64 const net::BackoffEntry::Policy& backoff_policy,
58 scoped_refptr<net::HttpNetworkSession> network_session, 65 scoped_refptr<net::HttpNetworkSession> network_session,
59 net::NetLog* net_log); 66 net::NetLog* net_log);
60 }; 67 };
61 68
62 // Implements the GCM Client. It is used to coordinate MCS Client (communication 69 // Implements the GCM Client. It is used to coordinate MCS Client (communication
63 // with MCS) and other pieces of GCM infrastructure like Registration and 70 // with MCS) and other pieces of GCM infrastructure like Registration and
64 // Checkins. It also allows for registering user delegates that host 71 // Checkins. It also allows for registering user delegates that host
(...skipping 14 matching lines...) Expand all
79 Delegate* delegate) OVERRIDE; 86 Delegate* delegate) OVERRIDE;
80 virtual void Load() OVERRIDE; 87 virtual void Load() OVERRIDE;
81 virtual void Stop() OVERRIDE; 88 virtual void Stop() OVERRIDE;
82 virtual void CheckOut() OVERRIDE; 89 virtual void CheckOut() OVERRIDE;
83 virtual void Register(const std::string& app_id, 90 virtual void Register(const std::string& app_id,
84 const std::vector<std::string>& sender_ids) OVERRIDE; 91 const std::vector<std::string>& sender_ids) OVERRIDE;
85 virtual void Unregister(const std::string& app_id) OVERRIDE; 92 virtual void Unregister(const std::string& app_id) OVERRIDE;
86 virtual void Send(const std::string& app_id, 93 virtual void Send(const std::string& app_id,
87 const std::string& receiver_id, 94 const std::string& receiver_id,
88 const OutgoingMessage& message) OVERRIDE; 95 const OutgoingMessage& message) OVERRIDE;
96 virtual void SetRecording(bool recording) OVERRIDE;
97 virtual void ClearActivityLogs() OVERRIDE;
89 virtual GCMStatistics GetStatistics() const OVERRIDE; 98 virtual GCMStatistics GetStatistics() const OVERRIDE;
90 99
91 private: 100 private:
92 // State representation of the GCMClient. 101 // State representation of the GCMClient.
93 // Any change made to this enum should have corresponding change in the 102 // Any change made to this enum should have corresponding change in the
94 // GetStateString(...) function. 103 // GetStateString(...) function.
95 enum State { 104 enum State {
96 // Uninitialized. 105 // Uninitialized.
97 UNINITIALIZED, 106 UNINITIALIZED,
98 // Initialized, 107 // Initialized,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 212
204 // Fires OnMessageSendError event on the delegate of this calss, based on the 213 // Fires OnMessageSendError event on the delegate of this calss, based on the
205 // details in |data_message_stanza| and |message_data|. 214 // details in |data_message_stanza| and |message_data|.
206 void HandleIncomingSendError( 215 void HandleIncomingSendError(
207 const mcs_proto::DataMessageStanza& data_message_stanza, 216 const mcs_proto::DataMessageStanza& data_message_stanza,
208 MessageData& message_data); 217 MessageData& message_data);
209 218
210 // Builder for the GCM internals (mcs client, etc.). 219 // Builder for the GCM internals (mcs client, etc.).
211 scoped_ptr<GCMInternalsBuilder> internals_builder_; 220 scoped_ptr<GCMInternalsBuilder> internals_builder_;
212 221
222 // Recorder that logs GCM activities.
223 GCMStatsRecorder recorder_;
224
213 // State of the GCM Client Implementation. 225 // State of the GCM Client Implementation.
214 State state_; 226 State state_;
215 227
216 Delegate* delegate_; 228 Delegate* delegate_;
217 229
218 // Device checkin info (android ID and security token used by device). 230 // Device checkin info (android ID and security token used by device).
219 CheckinInfo device_checkin_info_; 231 CheckinInfo device_checkin_info_;
220 232
221 // Clock used for timing of retry logic. Passed in for testing. Owned by 233 // Clock used for timing of retry logic. Passed in for testing. Owned by
222 // GCMClientImpl. 234 // GCMClientImpl.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 270
259 // Factory for creating references in callbacks. 271 // Factory for creating references in callbacks.
260 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; 272 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;
261 273
262 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); 274 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl);
263 }; 275 };
264 276
265 } // namespace gcm 277 } // namespace gcm
266 278
267 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ 279 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « google_apis/gcm/gcm_client.cc ('k') | google_apis/gcm/gcm_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698