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

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

Issue 1124783002: [GCM] Wiring heartbeat interval calls to GCMDriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@store-heartbeat-gcm
Patch Set: Addressing final feedback and fixing formatting Created 5 years, 7 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/engine/gcm_store.cc ('k') | google_apis/gcm/engine/mcs_client.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_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>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 // Allows a caller to set a heartbeat interval (in milliseconds) with which 154 // Allows a caller to set a heartbeat interval (in milliseconds) with which
155 // the MCS connection will be monitored on both ends, to detect device 155 // the MCS connection will be monitored on both ends, to detect device
156 // presence. In case the newly set interval is less then the current one, 156 // presence. In case the newly set interval is less then the current one,
157 // connection will be restarted with new heartbeat interval. Valid values have 157 // connection will be restarted with new heartbeat interval. Valid values have
158 // to be between GetMax/GetMinClientHeartbeatIntervalMs of HeartbeatManager, 158 // to be between GetMax/GetMinClientHeartbeatIntervalMs of HeartbeatManager,
159 // otherwise the setting won't take effect. 159 // otherwise the setting won't take effect.
160 void AddHeartbeatInterval(const std::string& scope, int interval_ms); 160 void AddHeartbeatInterval(const std::string& scope, int interval_ms);
161 void RemoveHeartbeatInterval(const std::string& scope); 161 void RemoveHeartbeatInterval(const std::string& scope);
162 162
163 HeartbeatManager& GetHeartbeatManagerForTesting() { 163 HeartbeatManager* GetHeartbeatManagerForTesting() {
164 return heartbeat_manager_; 164 return &heartbeat_manager_;
165 } 165 }
166 166
167 private: 167 private:
168 typedef uint32 StreamId; 168 typedef uint32 StreamId;
169 typedef std::string PersistentId; 169 typedef std::string PersistentId;
170 typedef std::vector<StreamId> StreamIdList; 170 typedef std::vector<StreamId> StreamIdList;
171 typedef std::vector<PersistentId> PersistentIdList; 171 typedef std::vector<PersistentId> PersistentIdList;
172 typedef std::map<StreamId, PersistentId> StreamIdToPersistentIdMap; 172 typedef std::map<StreamId, PersistentId> StreamIdToPersistentIdMap;
173 typedef linked_ptr<ReliablePacketInfo> MCSPacketInternal; 173 typedef linked_ptr<ReliablePacketInfo> MCSPacketInternal;
174 174
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 ConnectionFactory::ConnectionResetReason reason); 218 ConnectionFactory::ConnectionResetReason reason);
219 219
220 // Runs the message_sent_callback_ with send |status| of the |protobuf|. 220 // Runs the message_sent_callback_ with send |status| of the |protobuf|.
221 void NotifyMessageSendStatus(const google::protobuf::MessageLite& protobuf, 221 void NotifyMessageSendStatus(const google::protobuf::MessageLite& protobuf,
222 MessageSendStatus status); 222 MessageSendStatus status);
223 223
224 // Pops the next message from the front of the send queue (cleaning up 224 // Pops the next message from the front of the send queue (cleaning up
225 // any associated state). 225 // any associated state).
226 MCSPacketInternal PopMessageForSend(); 226 MCSPacketInternal PopMessageForSend();
227 227
228 // Gets the minimum interval from the map of scopes to intervals. 228 // Gets the minimum interval from the map of scopes to intervals in
229 int GetMinCustomHeartbeatInterval(); 229 // milliseconds.
230 int GetMinHeartbeatIntervalMs();
230 231
231 // Local version string. Sent on login. 232 // Local version string. Sent on login.
232 const std::string version_string_; 233 const std::string version_string_;
233 234
234 // Clock for enforcing TTL. Passed in for testing. 235 // Clock for enforcing TTL. Passed in for testing.
235 base::Clock* const clock_; 236 base::Clock* const clock_;
236 237
237 // Client state. 238 // Client state.
238 State state_; 239 State state_;
239 240
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 GCMStatsRecorder* recorder_; 305 GCMStatsRecorder* recorder_;
305 306
306 base::WeakPtrFactory<MCSClient> weak_ptr_factory_; 307 base::WeakPtrFactory<MCSClient> weak_ptr_factory_;
307 308
308 DISALLOW_COPY_AND_ASSIGN(MCSClient); 309 DISALLOW_COPY_AND_ASSIGN(MCSClient);
309 }; 310 };
310 311
311 } // namespace gcm 312 } // namespace gcm
312 313
313 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ 314 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/gcm_store.cc ('k') | google_apis/gcm/engine/mcs_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698