summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-10 04:11:33 +0000
committerskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-10 04:11:33 +0000
commitcecf1b672ccd147c72562b6acc4024522873c7c0 (patch)
tree1e0bfb3dda982447971494484f666ae333b5a47b
parent885783f28452024c0af94beefb24817fdef2750c (diff)
downloadchromium_src-cecf1b672ccd147c72562b6acc4024522873c7c0.zip
chromium_src-cecf1b672ccd147c72562b6acc4024522873c7c0.tar.gz
chromium_src-cecf1b672ccd147c72562b6acc4024522873c7c0.tar.bz2
Delay the nudge when syncing only preferences.
BUG=37365 Review URL: http://codereview.chromium.org/1611019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44182 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/syncapi.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 099d83d..331126d 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -982,6 +982,9 @@ class BridgedGaiaAuthenticator : public browser_sync::GaiaAuthenticator {
//////////////////////////////////////////////////////////////////////////
// SyncManager's implementation: SyncManager::SyncInternal
class SyncManager::SyncInternal {
+ static const int kDefaultNudgeDelayMilliseconds;
+ static const int kPreferencesNudgeDelayMilliseconds;
+
public:
explicit SyncInternal(SyncManager* sync_manager)
: observer_(NULL),
@@ -1272,6 +1275,8 @@ class SyncManager::SyncInternal {
bool initialized_;
mutable Lock initialized_mutex_;
};
+const int SyncManager::SyncInternal::kDefaultNudgeDelayMilliseconds = 200;
+const int SyncManager::SyncInternal::kPreferencesNudgeDelayMilliseconds = 2000;
SyncManager::SyncManager() {
data_ = new SyncInternal(this);
@@ -1669,6 +1674,7 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi(
"CALCULATE_CHANGES called with unapplied old changes.";
bool exists_unsynced_items = false;
+ bool only_preference_changes = true;
for (syncable::OriginalEntries::const_iterator i = event.originals->begin();
i != event.originals->end() && !exists_unsynced_items;
++i) {
@@ -1686,10 +1692,15 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi(
}
// Unsynced items will cause us to nudge the the syncer.
exists_unsynced_items = true;
+
+ if (model_type != syncable::PREFERENCES)
+ only_preference_changes = false;
}
}
if (exists_unsynced_items && syncer_thread()) {
- syncer_thread()->NudgeSyncer(200, SyncerThread::kLocal); // 1/5 a second.
+ int nudge_delay = only_preference_changes ?
+ kPreferencesNudgeDelayMilliseconds : kDefaultNudgeDelayMilliseconds;
+ syncer_thread()->NudgeSyncer(nudge_delay, SyncerThread::kLocal);
}
}