diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 18:27:01 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 18:27:01 +0000 |
commit | c98c928aa38e31d44c7a792f0d12da84471639ff (patch) | |
tree | 1e1050d39385fbdb787f5ae15dd2a38a143c8ebd /chrome/browser/sync/engine | |
parent | bab01969064bdb23cbd403aa86ddc85659d7b74e (diff) | |
download | chromium_src-c98c928aa38e31d44c7a792f0d12da84471639ff.zip chromium_src-c98c928aa38e31d44c7a792f0d12da84471639ff.tar.gz chromium_src-c98c928aa38e31d44c7a792f0d12da84471639ff.tar.bz2 |
Revert 79651 - Coverity: Pass parameters by reference.
Also remove an unused function that I found.
CID=2634,4471,5392,6433,6434,6535,6777,6780,6781,6792,6810,7665,7759,8056,8072,
8637,8718,8726
BUG=none
TEST=non
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/6730046
TBR=jhawkins@chromium.org
Review URL: http://codereview.chromium.org/6773015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/engine')
-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 |
3 files changed, 35 insertions, 7 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); |