diff options
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc | 10 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer_util.cc | 24 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncer_util.h | 8 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable.h | 8 |
5 files changed, 40 insertions, 12 deletions
diff --git a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc index 5c79492..0d14069 100644 --- a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc +++ b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -312,8 +312,8 @@ class ServerDeletedPathChecker { // returns 0 if we should stop investigating the path. static syncable::Id GetAndExamineParent(syncable::BaseTransaction* trans, - const syncable::Id& id, - const syncable::Id& check_id, + syncable::Id id, + syncable::Id check_id, const syncable::Entry& log_entry) { syncable::Entry parent(trans, syncable::GET_BY_ID, id); CHECK(parent.good()) << "Tree inconsitency, missing id" << id << " " @@ -334,8 +334,8 @@ class LocallyDeletedPathChecker { // returns 0 if we should stop investigating the path. static syncable::Id GetAndExamineParent(syncable::BaseTransaction* trans, - const syncable::Id& id, - const syncable::Id& check_id, + syncable::Id id, + syncable::Id check_id, const syncable::Entry& log_entry) { syncable::Entry parent(trans, syncable::GET_BY_ID, id); if (!parent.good()) diff --git a/chrome/browser/sync/engine/syncer_util.cc b/chrome/browser/sync/engine/syncer_util.cc index c20e206..c1bed35 100644 --- a/chrome/browser/sync/engine/syncer_util.cc +++ b/chrome/browser/sync/engine/syncer_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -639,6 +639,28 @@ void SyncerUtil::AddPredecessorsThenItem( std::reverse(commit_ids->begin() + initial_size, commit_ids->end()); } +// TODO(ncarter): This is redundant to some code in GetCommitIdsCommand. Unify +// them. +// static +void SyncerUtil::AddUncommittedParentsAndTheirPredecessors( + syncable::BaseTransaction* trans, + syncable::MetahandleSet* inserted_items, + std::vector<syncable::Id>* commit_ids, + syncable::Id parent_id) { + size_t intial_commit_ids_size = commit_ids->size(); + // Climb the tree adding entries leaf -> root. + while (!parent_id.ServerKnows()) { + Entry parent(trans, GET_BY_ID, parent_id); + CHECK(parent.good()) << "Bad user-only parent in item path."; + if (!AddItemThenPredecessors(trans, &parent, IS_UNSYNCED, inserted_items, + commit_ids)) + break; // Parent was already present in |inserted_items|. + parent_id = parent.Get(PARENT_ID); + } + // Reverse what we added to get the correct order. + std::reverse(commit_ids->begin() + intial_commit_ids_size, commit_ids->end()); +} + // static void SyncerUtil::MarkDeletedChildrenSynced( const syncable::ScopedDirLookup &dir, diff --git a/chrome/browser/sync/engine/syncer_util.h b/chrome/browser/sync/engine/syncer_util.h index 90de980..b1d5e50 100644 --- a/chrome/browser/sync/engine/syncer_util.h +++ b/chrome/browser/sync/engine/syncer_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -127,6 +127,12 @@ class SyncerUtil { syncable::MetahandleSet* inserted_items, std::vector<syncable::Id>* commit_ids); + static void AddUncommittedParentsAndTheirPredecessors( + syncable::BaseTransaction* trans, + syncable::MetahandleSet* inserted_items, + std::vector<syncable::Id>* commit_ids, + syncable::Id parent_id); + static void MarkDeletedChildrenSynced( const syncable::ScopedDirLookup &dir, std::set<syncable::Id>* deleted_folders); diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 395e6cc..e9abb9e 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -886,7 +886,7 @@ string Directory::store_birthday() const { return kernel_->persisted_info.store_birthday; } -void Directory::set_store_birthday(const string& store_birthday) { +void Directory::set_store_birthday(string store_birthday) { ScopedKernelLock lock(this); if (kernel_->persisted_info.store_birthday == store_birthday) return; diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index 55f76bb..f20e80f 100644 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -810,11 +810,11 @@ class Directory { const std::string& name() const { return kernel_->name; } - // (Account) Store birthday is opaque to the client, so we keep it in the - // format it is in the proto buffer in case we switch to a binary birthday - // later. + // (Account) Store birthday is opaque to the client, + // so we keep it in the format it is in the proto buffer + // in case we switch to a binary birthday later. std::string store_birthday() const; - void set_store_birthday(const std::string& store_birthday); + void set_store_birthday(std::string store_birthday); std::string GetAndClearNotificationState(); void SetNotificationState(const std::string& notification_state); |