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

Side by Side Diff: google_apis/gcm/engine/mcs_client.h

Issue 641943002: components: Introduce AlarmTimer class and use it for GCM heartbeat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gyp files 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 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_ENGINE_MCS_CLIENT_H_ 5 #ifndef GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_
6 #define GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ 6 #define GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "google_apis/gcm/base/gcm_export.h" 17 #include "google_apis/gcm/base/gcm_export.h"
17 #include "google_apis/gcm/base/mcs_message.h" 18 #include "google_apis/gcm/base/mcs_message.h"
18 #include "google_apis/gcm/engine/connection_handler.h" 19 #include "google_apis/gcm/engine/connection_handler.h"
19 #include "google_apis/gcm/engine/gcm_store.h" 20 #include "google_apis/gcm/engine/gcm_store.h"
20 #include "google_apis/gcm/engine/heartbeat_manager.h" 21 #include "google_apis/gcm/engine/heartbeat_manager.h"
21 22
22 namespace base { 23 namespace base {
23 class Clock; 24 class Clock;
25 class Timer;
24 } // namespace base 26 } // namespace base
25 27
26 namespace google { 28 namespace google {
27 namespace protobuf { 29 namespace protobuf {
28 class MessageLite; 30 class MessageLite;
29 } // namespace protobuf 31 } // namespace protobuf
30 } // namespace google 32 } // namespace google
31 33
32 namespace mcs_proto { 34 namespace mcs_proto {
33 class LoginRequest; 35 class LoginRequest;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const std::string& message_id, 96 const std::string& message_id,
95 MessageSendStatus status)> OnMessageSentCallback; 97 MessageSendStatus status)> OnMessageSentCallback;
96 98
97 MCSClient(const std::string& version_string, 99 MCSClient(const std::string& version_string,
98 base::Clock* clock, 100 base::Clock* clock,
99 ConnectionFactory* connection_factory, 101 ConnectionFactory* connection_factory,
100 GCMStore* gcm_store, 102 GCMStore* gcm_store,
101 GCMStatsRecorder* recorder); 103 GCMStatsRecorder* recorder);
102 virtual ~MCSClient(); 104 virtual ~MCSClient();
103 105
106 // Change the timer used for triggering heartbeats. On Chrome OS, we want to
107 // change the default timer to one that is capable of waking the system from
108 // suspend to ensure that heartbeat messages are sent regularly.
109 void SetHeartbeatTimer(scoped_ptr<base::Timer> timer);
Nicolas Zea 2014/10/22 17:32:16 I think you can pass this in at construction time
110
104 // Initialize the client. Will load any previous id/token information as well 111 // Initialize the client. Will load any previous id/token information as well
105 // as unacknowledged message information from the GCM storage, if it exists, 112 // as unacknowledged message information from the GCM storage, if it exists,
106 // passing the id/token information back via |initialization_callback| along 113 // passing the id/token information back via |initialization_callback| along
107 // with a |success == true| result. If no GCM information is present (and 114 // with a |success == true| result. If no GCM information is present (and
108 // this is therefore a fresh client), a clean GCM store will be created and 115 // this is therefore a fresh client), a clean GCM store will be created and
109 // values of 0 will be returned via |initialization_callback| with 116 // values of 0 will be returned via |initialization_callback| with
110 // |success == true|. 117 // |success == true|.
111 /// If an error loading the GCM store is encountered, 118 /// If an error loading the GCM store is encountered,
112 // |initialization_callback| will be invoked with |success == false|. 119 // |initialization_callback| will be invoked with |success == false|.
113 void Initialize(const ErrorCallback& initialization_callback, 120 void Initialize(const ErrorCallback& initialization_callback,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 GCMStatsRecorder* recorder_; 285 GCMStatsRecorder* recorder_;
279 286
280 base::WeakPtrFactory<MCSClient> weak_ptr_factory_; 287 base::WeakPtrFactory<MCSClient> weak_ptr_factory_;
281 288
282 DISALLOW_COPY_AND_ASSIGN(MCSClient); 289 DISALLOW_COPY_AND_ASSIGN(MCSClient);
283 }; 290 };
284 291
285 } // namespace gcm 292 } // namespace gcm
286 293
287 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ 294 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698