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

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

Issue 910093003: Reset the GCM store to recover from it when it is busted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more feedback Created 5 years, 10 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 | « no previous file | components/gcm_driver/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 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_CLIENT_IMPL_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // initialization. 191 // initialization.
192 void OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result); 192 void OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result);
193 // Starts the GCM. 193 // Starts the GCM.
194 void StartGCM(); 194 void StartGCM();
195 // Initializes mcs_client_, which handles the connection to MCS. 195 // Initializes mcs_client_, which handles the connection to MCS.
196 void InitializeMCSClient(); 196 void InitializeMCSClient();
197 // Complets the first time device checkin. 197 // Complets the first time device checkin.
198 void OnFirstTimeDeviceCheckinCompleted(const CheckinInfo& checkin_info); 198 void OnFirstTimeDeviceCheckinCompleted(const CheckinInfo& checkin_info);
199 // Starts a login on mcs_client_. 199 // Starts a login on mcs_client_.
200 void StartMCSLogin(); 200 void StartMCSLogin();
201 // Resets state to before initialization. 201 // Resets the GCM store when it is corrupted.
202 void ResetState(); 202 void ResetStore();
203 // Sets state to ready. This will initiate the MCS login and notify the 203 // Sets state to ready. This will initiate the MCS login and notify the
204 // delegates. 204 // delegates.
205 void OnReady(const std::vector<AccountMapping>& account_mappings, 205 void OnReady(const std::vector<AccountMapping>& account_mappings,
206 const base::Time& last_token_fetch_time); 206 const base::Time& last_token_fetch_time);
207 207
208 // Starts a first time device checkin. 208 // Starts a first time device checkin.
209 void StartCheckin(); 209 void StartCheckin();
210 // Completes the device checkin request by parsing the |checkin_response|. 210 // Completes the device checkin request by parsing the |checkin_response|.
211 // Function also cleans up the pending checkin. 211 // Function also cleans up the pending checkin.
212 void OnCheckinCompleted( 212 void OnCheckinCompleted(
(...skipping 17 matching lines...) Expand all
230 // Callback for persisting registration info in the |gcm_store_|. 230 // Callback for persisting registration info in the |gcm_store_|.
231 void UpdateRegistrationCallback(bool success); 231 void UpdateRegistrationCallback(bool success);
232 232
233 // Callback for all store operations that do not try to recover, if write in 233 // Callback for all store operations that do not try to recover, if write in
234 // |gcm_store_| fails. 234 // |gcm_store_| fails.
235 void DefaultStoreCallback(bool success); 235 void DefaultStoreCallback(bool success);
236 236
237 // Callback for store operation where result does not matter. 237 // Callback for store operation where result does not matter.
238 void IgnoreWriteResultCallback(bool success); 238 void IgnoreWriteResultCallback(bool success);
239 239
240 // Callback for resetting the GCM store.
241 void ResetStoreCallback(bool success);
242
240 // Completes the registration request. 243 // Completes the registration request.
241 void OnRegisterCompleted(const std::string& app_id, 244 void OnRegisterCompleted(const std::string& app_id,
242 const std::vector<std::string>& sender_ids, 245 const std::vector<std::string>& sender_ids,
243 RegistrationRequest::Status status, 246 RegistrationRequest::Status status,
244 const std::string& registration_id); 247 const std::string& registration_id);
245 248
246 // Completes the unregistration request. 249 // Completes the unregistration request.
247 void OnUnregisterCompleted(const std::string& app_id, 250 void OnUnregisterCompleted(const std::string& app_id,
248 UnregistrationRequest::Status status); 251 UnregistrationRequest::Status status);
249 252
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // TODO(fgorski): Check if it can be passed in constructor and made const. 299 // TODO(fgorski): Check if it can be passed in constructor and made const.
297 ChromeBuildInfo chrome_build_info_; 300 ChromeBuildInfo chrome_build_info_;
298 301
299 // Persistent data store for keeping device credentials, messages and user to 302 // Persistent data store for keeping device credentials, messages and user to
300 // serial number mappings. 303 // serial number mappings.
301 scoped_ptr<GCMStore> gcm_store_; 304 scoped_ptr<GCMStore> gcm_store_;
302 305
303 // Data loaded from the GCM store. 306 // Data loaded from the GCM store.
304 scoped_ptr<GCMStore::LoadResult> load_result_; 307 scoped_ptr<GCMStore::LoadResult> load_result_;
305 308
309 // Tracks if the GCM store has been reset. This is used to prevent from
310 // resetting and loading from the store again and again.
311 bool gcm_store_reset_;
312
306 scoped_refptr<net::HttpNetworkSession> network_session_; 313 scoped_refptr<net::HttpNetworkSession> network_session_;
307 net::BoundNetLog net_log_; 314 net::BoundNetLog net_log_;
308 scoped_ptr<ConnectionFactory> connection_factory_; 315 scoped_ptr<ConnectionFactory> connection_factory_;
309 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 316 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
310 317
311 // Controls receiving and sending of packets and reliable message queueing. 318 // Controls receiving and sending of packets and reliable message queueing.
312 scoped_ptr<MCSClient> mcs_client_; 319 scoped_ptr<MCSClient> mcs_client_;
313 320
314 scoped_ptr<CheckinRequest> checkin_request_; 321 scoped_ptr<CheckinRequest> checkin_request_;
315 322
(...skipping 23 matching lines...) Expand all
339 346
340 // Factory for creating references in callbacks. 347 // Factory for creating references in callbacks.
341 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; 348 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;
342 349
343 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); 350 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl);
344 }; 351 };
345 352
346 } // namespace gcm 353 } // namespace gcm
347 354
348 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_ 355 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | components/gcm_driver/gcm_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698