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

Side by Side Diff: sync/internal_api/public/sync_manager.h

Issue 23717047: Retry: sync: Gracefully handle early shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move signals to SyncaBackendHost::Core Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 class Encryptor; 38 class Encryptor;
39 struct Experiments; 39 struct Experiments;
40 class ExtensionsActivity; 40 class ExtensionsActivity;
41 class HttpPostProviderFactory; 41 class HttpPostProviderFactory;
42 class InternalComponentsFactory; 42 class InternalComponentsFactory;
43 class JsBackend; 43 class JsBackend;
44 class JsEventHandler; 44 class JsEventHandler;
45 class SyncEncryptionHandler; 45 class SyncEncryptionHandler;
46 class SyncScheduler; 46 class SyncScheduler;
47 struct UserShare; 47 struct UserShare;
48 class CancelationSignal;
48 49
49 namespace sessions { 50 namespace sessions {
50 class SyncSessionSnapshot; 51 class SyncSessionSnapshot;
51 } // namespace sessions 52 } // namespace sessions
52 53
53 // Used by SyncManager::OnConnectionStatusChange(). 54 // Used by SyncManager::OnConnectionStatusChange().
54 enum ConnectionStatus { 55 enum ConnectionStatus {
55 CONNECTION_OK, 56 CONNECTION_OK,
56 CONNECTION_AUTH_ERROR, 57 CONNECTION_AUTH_ERROR,
57 CONNECTION_SERVER_ERROR 58 CONNECTION_SERVER_ERROR
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 ExtensionsActivity* extensions_activity, 314 ExtensionsActivity* extensions_activity,
314 ChangeDelegate* change_delegate, 315 ChangeDelegate* change_delegate,
315 const SyncCredentials& credentials, 316 const SyncCredentials& credentials,
316 const std::string& invalidator_client_id, 317 const std::string& invalidator_client_id,
317 const std::string& restored_key_for_bootstrapping, 318 const std::string& restored_key_for_bootstrapping,
318 const std::string& restored_keystore_key_for_bootstrapping, 319 const std::string& restored_keystore_key_for_bootstrapping,
319 InternalComponentsFactory* internal_components_factory, 320 InternalComponentsFactory* internal_components_factory,
320 Encryptor* encryptor, 321 Encryptor* encryptor,
321 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, 322 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler,
322 ReportUnrecoverableErrorFunction report_unrecoverable_error_function, 323 ReportUnrecoverableErrorFunction report_unrecoverable_error_function,
323 bool use_oauth2_token) = 0; 324 bool use_oauth2_token,
325 CancelationSignal* cancelation_signal) = 0;
tim (not reviewing) 2013/09/16 23:01:31 Comment param in list above.
rlarocque 2013/09/17 00:03:22 Done.
324 326
325 // Throw an unrecoverable error from a transaction (mostly used for 327 // Throw an unrecoverable error from a transaction (mostly used for
326 // testing). 328 // testing).
327 virtual void ThrowUnrecoverableError() = 0; 329 virtual void ThrowUnrecoverableError() = 0;
328 330
329 virtual ModelTypeSet InitialSyncEndedTypes() = 0; 331 virtual ModelTypeSet InitialSyncEndedTypes() = 0;
330 332
331 // Returns those types within |types| that have an empty progress marker 333 // Returns those types within |types| that have an empty progress marker
332 // token. 334 // token.
333 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( 335 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // potentially dereference garbage. 387 // potentially dereference garbage.
386 virtual void RemoveObserver(Observer* observer) = 0; 388 virtual void RemoveObserver(Observer* observer) = 0;
387 389
388 // Status-related getter. May be called on any thread. 390 // Status-related getter. May be called on any thread.
389 virtual SyncStatus GetDetailedStatus() const = 0; 391 virtual SyncStatus GetDetailedStatus() const = 0;
390 392
391 // Call periodically from a database-safe thread to persist recent changes 393 // Call periodically from a database-safe thread to persist recent changes
392 // to the syncapi model. 394 // to the syncapi model.
393 virtual void SaveChanges() = 0; 395 virtual void SaveChanges() = 0;
394 396
395 // Initiates shutdown of various components in the sync engine. Must be
396 // called from the main thread to allow preempting ongoing tasks on the sync
397 // loop (that may be blocked on I/O). The semantics of |callback| are the
398 // same as with StartConfigurationMode. If provided and a scheduler / sync
399 // loop exists, it will be invoked from the sync loop by the scheduler to
400 // notify that all work has been flushed + cancelled, and it is idle.
401 // If no scheduler exists, the callback is run immediately (from the loop
402 // this was created on, which is the sync loop), as sync is effectively
403 // stopped.
404 virtual void StopSyncingForShutdown() = 0;
405
406 // Issue a final SaveChanges, and close sqlite handles. 397 // Issue a final SaveChanges, and close sqlite handles.
407 virtual void ShutdownOnSyncThread() = 0; 398 virtual void ShutdownOnSyncThread() = 0;
408 399
409 // May be called from any thread. 400 // May be called from any thread.
410 virtual UserShare* GetUserShare() = 0; 401 virtual UserShare* GetUserShare() = 0;
411 402
412 // Returns the cache_guid of the currently open database. 403 // Returns the cache_guid of the currently open database.
413 // Requires that the SyncManager be initialized. 404 // Requires that the SyncManager be initialized.
414 virtual const std::string cache_guid() = 0; 405 virtual const std::string cache_guid() = 0;
415 406
416 // Reads the nigori node to determine if any experimental features should 407 // Reads the nigori node to determine if any experimental features should
417 // be enabled. 408 // be enabled.
418 // Note: opens a transaction. May be called on any thread. 409 // Note: opens a transaction. May be called on any thread.
419 virtual bool ReceivedExperiment(Experiments* experiments) = 0; 410 virtual bool ReceivedExperiment(Experiments* experiments) = 0;
420 411
421 // Uses a read-only transaction to determine if the directory being synced has 412 // Uses a read-only transaction to determine if the directory being synced has
422 // any remaining unsynced items. May be called on any thread. 413 // any remaining unsynced items. May be called on any thread.
423 virtual bool HasUnsyncedItems() = 0; 414 virtual bool HasUnsyncedItems() = 0;
424 415
425 // Returns the SyncManager's encryption handler. 416 // Returns the SyncManager's encryption handler.
426 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; 417 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0;
427 418
428 // Ask the SyncManager to fetch updates for the given types. 419 // Ask the SyncManager to fetch updates for the given types.
429 virtual void RefreshTypes(ModelTypeSet types) = 0; 420 virtual void RefreshTypes(ModelTypeSet types) = 0;
430 }; 421 };
431 422
432 } // namespace syncer 423 } // namespace syncer
433 424
434 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ 425 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698