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

Unified Diff: sync/api/syncable_service.h

Issue 14018026: sync: SyncableService support for starting sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sync/api/syncable_service.h
diff --git a/sync/api/syncable_service.h b/sync/api/syncable_service.h
index 13c282ef5a601484bf7a05656a441a33f2e5bb0a..ec2b8b02c614620b048a64c471217f4d49b93a40 100644
--- a/sync/api/syncable_service.h
+++ b/sync/api/syncable_service.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -21,6 +22,16 @@ namespace syncer {
class SyncErrorFactory;
+// Used as a parameter to InjectStartSyncFlare. The StartSyncFlare is useful
+// when your SyncableService has a need for sync to start ASAP, typically
+// because a local change event has occurred but MergeDataAndStartSyncing
+// hasn't been called yet, meaning you don't have a SyncChangeProcessor.
+// The sync subsystem will respond soon after invoking Run() on your flare
+// by calling MergeDataAndStartSyncing. The ModelType parameter is included so
+// that the recieving end can track usage and timing statistics, make
+// optimizations or tradeoffs by type, etc.
+typedef base::Callback<void(ModelType)> StartSyncFlare;
+
// TODO(zea): remove SupportsWeakPtr in favor of having all SyncableService
// implementers provide a way of getting a weak pointer to themselves.
// See crbug.com/100114.
@@ -28,6 +39,10 @@ class SYNC_EXPORT SyncableService
: public SyncChangeProcessor,
public base::SupportsWeakPtr<SyncableService> {
public:
+ // Provides a StartSyncFlare to the SyncableService.
+ // TODO(tim): BUG 80194. Make pure virtual.
+ virtual void InjectStartSyncFlare(const StartSyncFlare& flare);
+
// Informs the service to begin syncing the specified synced datatype |type|.
// The service should then merge |initial_sync_data| into it's local data,
// calling |sync_processor|'s ProcessSyncChanges as necessary to reconcile the

Powered by Google App Engine
This is Rietveld 408576698