summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 23:45:49 +0000
committerchron@chromium.org <chron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 23:45:49 +0000
commit8d9a3202d846c6b89b0646c26307aeb1c05e7ffb (patch)
tree9767c3639d8ed90e76df6e14dd8315f127d4d1be
parentedf4898029126a651010d85c55c9bc0f54f23436 (diff)
downloadchromium_src-8d9a3202d846c6b89b0646c26307aeb1c05e7ffb.zip
chromium_src-8d9a3202d846c6b89b0646c26307aeb1c05e7ffb.tar.gz
chromium_src-8d9a3202d846c6b89b0646c26307aeb1c05e7ffb.tar.bz2
Fix sync bug where notifications were being sent for unsuccessful commit attempts.
BUG=24996 TEST=Manually tested Review URL: http://codereview.chromium.org/284008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29357 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/syncapi.cc6
-rw-r--r--chrome/browser/sync/engine/syncer_session.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 0edc70d..7d953d0 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -1404,8 +1404,10 @@ void SyncManager::SyncInternal::HandleSyncerEvent(const SyncerEvent& event) {
}
// TODO(chron): Consider changing this back to track HasMoreToSync
- // Only notify peers if a commit has occurred and change the bookmark model.
- if (event.last_session && event.last_session->items_committed()) {
+ // Only notify peers if a successful commit has occurred.
+ if (event.last_session && event.last_session->HadSuccessfulCommits()) {
+ // We use a member variable here because talk may not have connected yet.
+ // The notification must be stored until it can be sent.
notification_pending_ = true;
}
diff --git a/chrome/browser/sync/engine/syncer_session.h b/chrome/browser/sync/engine/syncer_session.h
index c75458f..83643d7 100644
--- a/chrome/browser/sync/engine/syncer_session.h
+++ b/chrome/browser/sync/engine/syncer_session.h
@@ -153,6 +153,10 @@ class SyncerSession {
return sync_cycle_state_->commit_ids_empty();
}
+ bool HadSuccessfulCommits() const {
+ return sync_process_state_->successful_commits() > 0;
+ }
+
syncable::WriteTransaction* write_transaction() const {
return sync_cycle_state_->write_transaction();
}