OLD | NEW |
---|---|
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 Loading... | |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. |
229 int GetMinCustomHeartbeatInterval(); | 229 int GetMinHeartbeatInterval(); |
Nicolas Zea
2015/05/13 17:57:37
nit: maybe call this GetHeartbeatIntervalMs (and m
fgorski
2015/05/13 18:59:16
Done.
| |
230 | 230 |
231 // Local version string. Sent on login. | 231 // Local version string. Sent on login. |
232 const std::string version_string_; | 232 const std::string version_string_; |
233 | 233 |
234 // Clock for enforcing TTL. Passed in for testing. | 234 // Clock for enforcing TTL. Passed in for testing. |
235 base::Clock* const clock_; | 235 base::Clock* const clock_; |
236 | 236 |
237 // Client state. | 237 // Client state. |
238 State state_; | 238 State state_; |
239 | 239 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 GCMStatsRecorder* recorder_; | 304 GCMStatsRecorder* recorder_; |
305 | 305 |
306 base::WeakPtrFactory<MCSClient> weak_ptr_factory_; | 306 base::WeakPtrFactory<MCSClient> weak_ptr_factory_; |
307 | 307 |
308 DISALLOW_COPY_AND_ASSIGN(MCSClient); | 308 DISALLOW_COPY_AND_ASSIGN(MCSClient); |
309 }; | 309 }; |
310 | 310 |
311 } // namespace gcm | 311 } // namespace gcm |
312 | 312 |
313 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ | 313 #endif // GOOGLE_APIS_GCM_ENGINE_MCS_CLIENT_H_ |
OLD | NEW |