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

Unified Diff: chrome/browser/extensions/api/storage/syncable_settings_storage.cc

Issue 138073006: sync: fix the way extension/app settings trigger deferred sync init (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « chrome/browser/extensions/api/storage/syncable_settings_storage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/storage/syncable_settings_storage.cc
diff --git a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
index 5c4b13e272fed41c823e6bca7a3fa86b704532b5..db877c6882bad8e34362faf01c7b9974e48fd2cc 100644
--- a/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
+++ b/chrome/browser/extensions/api/storage/syncable_settings_storage.cc
@@ -20,10 +20,14 @@ SyncableSettingsStorage::SyncableSettingsStorage(
const scoped_refptr<ObserverListThreadSafe<SettingsObserver> >&
observers,
const std::string& extension_id,
- ValueStore* delegate)
+ ValueStore* delegate,
+ syncer::ModelType sync_type,
+ const syncer::SyncableService::StartSyncFlare& flare)
: observers_(observers),
extension_id_(extension_id),
- delegate_(delegate) {
+ delegate_(delegate),
+ sync_type_(sync_type),
+ flare_(flare) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
}
@@ -120,10 +124,18 @@ ValueStore::WriteResult SyncableSettingsStorage::Clear() {
void SyncableSettingsStorage::SyncResultIfEnabled(
const ValueStore::WriteResult& result) {
- if (sync_processor_.get() && !result->changes().empty()) {
+ if (result->changes().empty())
+ return;
+
+ if (sync_processor_.get()) {
syncer::SyncError error = sync_processor_->SendChanges(result->changes());
if (error.IsSet())
StopSyncing();
+ } else {
+ // Tell sync to try and start soon, because syncable changes to sync_type_
+ // have started happening. This will cause sync to call us back
+ // asynchronously via StartSyncing(...) as soon as possible.
+ flare_.Run(sync_type_);
not at google - send to devlin 2014/01/15 18:39:46 and it's ok to ignore the changes here because one
}
}
« no previous file with comments | « chrome/browser/extensions/api/storage/syncable_settings_storage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698