| Index: components/sync/syncable/model_neutral_mutable_entry.cc
|
| diff --git a/sync/syncable/model_neutral_mutable_entry.cc b/components/sync/syncable/model_neutral_mutable_entry.cc
|
| similarity index 88%
|
| rename from sync/syncable/model_neutral_mutable_entry.cc
|
| rename to components/sync/syncable/model_neutral_mutable_entry.cc
|
| index 5b90cf6f03f52ef38202c4f348c69330098b081a..526dd9d47f0c79e33dfe90048628cd87b3418169 100644
|
| --- a/sync/syncable/model_neutral_mutable_entry.cc
|
| +++ b/components/sync/syncable/model_neutral_mutable_entry.cc
|
| @@ -2,19 +2,19 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "sync/syncable/model_neutral_mutable_entry.h"
|
| +#include "components/sync/syncable/model_neutral_mutable_entry.h"
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| #include <string>
|
|
|
| -#include "sync/internal_api/public/base/unique_position.h"
|
| -#include "sync/syncable/directory.h"
|
| -#include "sync/syncable/scoped_kernel_lock.h"
|
| -#include "sync/syncable/syncable_changes_version.h"
|
| -#include "sync/syncable/syncable_util.h"
|
| -#include "sync/syncable/syncable_write_transaction.h"
|
| +#include "components/sync/base/unique_position.h"
|
| +#include "components/sync/syncable/directory.h"
|
| +#include "components/sync/syncable/scoped_kernel_lock.h"
|
| +#include "components/sync/syncable/syncable_changes_version.h"
|
| +#include "components/sync/syncable/syncable_util.h"
|
| +#include "components/sync/syncable/syncable_write_transaction.h"
|
|
|
| using std::string;
|
|
|
| @@ -86,25 +86,25 @@ ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans,
|
| kernel_ = kernel.release();
|
| }
|
|
|
| -ModelNeutralMutableEntry::ModelNeutralMutableEntry(
|
| - BaseWriteTransaction* trans, GetById, const Id& id)
|
| - : Entry(trans, GET_BY_ID, id), base_write_transaction_(trans) {
|
| -}
|
| +ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans,
|
| + GetById,
|
| + const Id& id)
|
| + : Entry(trans, GET_BY_ID, id), base_write_transaction_(trans) {}
|
|
|
| ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans,
|
| GetByHandle,
|
| int64_t metahandle)
|
| : Entry(trans, GET_BY_HANDLE, metahandle), base_write_transaction_(trans) {}
|
|
|
| -ModelNeutralMutableEntry::ModelNeutralMutableEntry(
|
| - BaseWriteTransaction* trans, GetByClientTag, const std::string& tag)
|
| - : Entry(trans, GET_BY_CLIENT_TAG, tag), base_write_transaction_(trans) {
|
| -}
|
| +ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans,
|
| + GetByClientTag,
|
| + const std::string& tag)
|
| + : Entry(trans, GET_BY_CLIENT_TAG, tag), base_write_transaction_(trans) {}
|
|
|
| -ModelNeutralMutableEntry::ModelNeutralMutableEntry(
|
| - BaseWriteTransaction* trans, GetTypeRoot, ModelType type)
|
| - : Entry(trans, GET_TYPE_ROOT, type), base_write_transaction_(trans) {
|
| -}
|
| +ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans,
|
| + GetTypeRoot,
|
| + ModelType type)
|
| + : Entry(trans, GET_TYPE_ROOT, type), base_write_transaction_(trans) {}
|
|
|
| void ModelNeutralMutableEntry::PutBaseVersion(int64_t value) {
|
| DCHECK(kernel_);
|
| @@ -172,14 +172,12 @@ bool ModelNeutralMutableEntry::PutIsUnsynced(bool value) {
|
| ScopedKernelLock lock(dir());
|
| if (value) {
|
| if (!SyncAssert(index->insert(kernel_->ref(META_HANDLE)).second,
|
| - FROM_HERE,
|
| - "Could not insert",
|
| + FROM_HERE, "Could not insert",
|
| base_write_transaction())) {
|
| return false;
|
| }
|
| } else {
|
| - if (!SyncAssert(1U == index->erase(kernel_->ref(META_HANDLE)),
|
| - FROM_HERE,
|
| + if (!SyncAssert(1U == index->erase(kernel_->ref(META_HANDLE)), FROM_HERE,
|
| "Entry Not succesfully erased",
|
| base_write_transaction())) {
|
| return false;
|
| @@ -198,20 +196,20 @@ bool ModelNeutralMutableEntry::PutIsUnappliedUpdate(bool value) {
|
| // Use kernel_->GetServerModelType() instead of
|
| // GetServerModelType() as we may trigger some DCHECKs in the
|
| // latter.
|
| - MetahandleSet* index = &dir()->kernel()->unapplied_update_metahandles[
|
| - kernel_->GetServerModelType()];
|
| + MetahandleSet* index =
|
| + &dir()
|
| + ->kernel()
|
| + ->unapplied_update_metahandles[kernel_->GetServerModelType()];
|
|
|
| ScopedKernelLock lock(dir());
|
| if (value) {
|
| if (!SyncAssert(index->insert(kernel_->ref(META_HANDLE)).second,
|
| - FROM_HERE,
|
| - "Could not insert",
|
| + FROM_HERE, "Could not insert",
|
| base_write_transaction())) {
|
| return false;
|
| }
|
| } else {
|
| - if (!SyncAssert(1U == index->erase(kernel_->ref(META_HANDLE)),
|
| - FROM_HERE,
|
| + if (!SyncAssert(1U == index->erase(kernel_->ref(META_HANDLE)), FROM_HERE,
|
| "Entry Not succesfully erased",
|
| base_write_transaction())) {
|
| return false;
|
| @@ -280,8 +278,7 @@ bool ModelNeutralMutableEntry::PutUniqueServerTag(const string& new_tag) {
|
| DVLOG(1) << "Detected duplicate server tag";
|
| return false;
|
| }
|
| - dir()->kernel()->server_tags_map.erase(
|
| - kernel_->ref(UNIQUE_SERVER_TAG));
|
| + dir()->kernel()->server_tags_map.erase(kernel_->ref(UNIQUE_SERVER_TAG));
|
| kernel_->put(UNIQUE_SERVER_TAG, new_tag);
|
| MarkDirty();
|
| if (!new_tag.empty()) {
|
| @@ -304,8 +301,7 @@ bool ModelNeutralMutableEntry::PutUniqueClientTag(const string& new_tag) {
|
| DVLOG(1) << "Detected duplicate client tag";
|
| return false;
|
| }
|
| - dir()->kernel()->client_tags_map.erase(
|
| - kernel_->ref(UNIQUE_CLIENT_TAG));
|
| + dir()->kernel()->client_tags_map.erase(kernel_->ref(UNIQUE_CLIENT_TAG));
|
| kernel_->put(UNIQUE_CLIENT_TAG, new_tag);
|
| MarkDirty();
|
| if (!new_tag.empty()) {
|
| @@ -330,9 +326,8 @@ void ModelNeutralMutableEntry::PutUniqueBookmarkTag(const std::string& tag) {
|
| // There is only one scenario where our tag is expected to change. That
|
| // scenario occurs when our current tag is a non-correct tag assigned during
|
| // the UniquePosition migration.
|
| - std::string migration_generated_tag =
|
| - GenerateSyncableBookmarkHash(std::string(),
|
| - kernel_->ref(ID).GetServerId());
|
| + std::string migration_generated_tag = GenerateSyncableBookmarkHash(
|
| + std::string(), kernel_->ref(ID).GetServerId());
|
| DCHECK_EQ(migration_generated_tag, kernel_->ref(UNIQUE_BOOKMARK_TAG));
|
| }
|
|
|
| @@ -355,8 +350,8 @@ void ModelNeutralMutableEntry::PutServerSpecifics(
|
| const ModelType old_server_type = kernel_->GetServerModelType();
|
| const int64_t metahandle = kernel_->ref(META_HANDLE);
|
| size_t erase_count =
|
| - dir()->kernel()->unapplied_update_metahandles[old_server_type]
|
| - .erase(metahandle);
|
| + dir()->kernel()->unapplied_update_metahandles[old_server_type].erase(
|
| + metahandle);
|
| DCHECK_EQ(erase_count, 1u);
|
| }
|
|
|
| @@ -374,8 +369,8 @@ void ModelNeutralMutableEntry::PutServerSpecifics(
|
| // new server type.
|
| const ModelType new_server_type = kernel_->GetServerModelType();
|
| const int64_t metahandle = kernel_->ref(META_HANDLE);
|
| - dir()->kernel()->unapplied_update_metahandles[new_server_type]
|
| - .insert(metahandle);
|
| + dir()->kernel()->unapplied_update_metahandles[new_server_type].insert(
|
| + metahandle);
|
| }
|
| }
|
| }
|
| @@ -455,7 +450,7 @@ void ModelNeutralMutableEntry::UpdateTransactionVersion(int64_t value) {
|
| }
|
|
|
| ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans)
|
| - : Entry(trans), base_write_transaction_(trans) {}
|
| + : Entry(trans), base_write_transaction_(trans) {}
|
|
|
| void ModelNeutralMutableEntry::MarkDirty() {
|
| kernel_->mark_dirty(&dir()->kernel()->dirty_metahandles);
|
|
|