Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Unified Diff: components/sync/engine_impl/apply_control_data_updates.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/engine_impl/apply_control_data_updates.cc
diff --git a/sync/engine/apply_control_data_updates.cc b/components/sync/engine_impl/apply_control_data_updates.cc
similarity index 87%
rename from sync/engine/apply_control_data_updates.cc
rename to components/sync/engine_impl/apply_control_data_updates.cc
index 0f5ae398c6aa9f9d15e651973fb2aa3456feb6ab..21d46d4ff5435a2addf34e14ebc175976b3a55c1 100644
--- a/sync/engine/apply_control_data_updates.cc
+++ b/components/sync/engine_impl/apply_control_data_updates.cc
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/engine/apply_control_data_updates.h"
+#include "components/sync/engine_impl/apply_control_data_updates.h"
#include <stdint.h>
#include <vector>
#include "base/metrics/histogram.h"
-#include "sync/engine/conflict_resolver.h"
-#include "sync/engine/conflict_util.h"
-#include "sync/engine/syncer_util.h"
-#include "sync/syncable/directory.h"
-#include "sync/syncable/mutable_entry.h"
-#include "sync/syncable/nigori_handler.h"
-#include "sync/syncable/nigori_util.h"
-#include "sync/syncable/syncable_write_transaction.h"
-#include "sync/util/cryptographer.h"
+#include "components/sync/base/cryptographer.h"
+#include "components/sync/engine_impl/conflict_resolver.h"
+#include "components/sync/engine_impl/conflict_util.h"
+#include "components/sync/engine_impl/syncer_util.h"
+#include "components/sync/syncable/directory.h"
+#include "components/sync/syncable/mutable_entry.h"
+#include "components/sync/syncable/nigori_handler.h"
+#include "components/sync/syncable/nigori_util.h"
+#include "components/sync/syncable/syncable_write_transaction.h"
namespace syncer {
@@ -25,8 +25,8 @@ void ApplyControlDataUpdates(syncable::Directory* dir) {
syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir);
std::vector<int64_t> handles;
- dir->GetUnappliedUpdateMetaHandles(
- &trans, ToFullModelTypeSet(ControlTypes()), &handles);
+ dir->GetUnappliedUpdateMetaHandles(&trans, ToFullModelTypeSet(ControlTypes()),
+ &handles);
// First, go through and manually apply any new top level datatype nodes (so
// that we don't have to worry about hitting a CONFLICT_HIERARCHY with an
@@ -57,13 +57,9 @@ void ApplyControlDataUpdates(syncable::Directory* dir) {
DCHECK_EQ(type, entry.GetServerModelType());
if (type == NIGORI) {
// Nigori node applications never fail.
- ApplyNigoriUpdate(&trans,
- &entry,
- dir->GetCryptographer(&trans));
+ ApplyNigoriUpdate(&trans, &entry, dir->GetCryptographer(&trans));
} else {
- ApplyControlUpdate(&trans,
- &entry,
- dir->GetCryptographer(&trans));
+ ApplyControlUpdate(&trans, &entry, dir->GetCryptographer(&trans));
}
}
@@ -81,9 +77,7 @@ void ApplyControlDataUpdates(syncable::Directory* dir) {
continue;
}
- ApplyControlUpdate(&trans,
- &entry,
- dir->GetCryptographer(&trans));
+ ApplyControlUpdate(&trans, &entry, dir->GetCryptographer(&trans));
}
}
@@ -108,8 +102,7 @@ void ApplyNigoriUpdate(syncable::WriteTransaction* const trans,
// TODO(zea): consider having this return a bool reflecting whether it was a
// valid update or not, and in the case of invalid updates not overwrite the
// local data.
- const sync_pb::NigoriSpecifics& nigori =
- entry->GetServerSpecifics().nigori();
+ const sync_pb::NigoriSpecifics& nigori = entry->GetServerSpecifics().nigori();
trans->directory()->GetNigoriHandler()->ApplyNigoriUpdate(nigori, trans);
// Make sure any unsynced changes are properly encrypted as necessary.
@@ -137,8 +130,7 @@ void ApplyNigoriUpdate(syncable::WriteTransaction* const trans,
const sync_pb::EntitySpecifics& server_specifics =
entry->GetServerSpecifics();
const sync_pb::NigoriSpecifics& server_nigori = server_specifics.nigori();
- const sync_pb::EntitySpecifics& local_specifics =
- entry->GetSpecifics();
+ const sync_pb::EntitySpecifics& local_specifics = entry->GetSpecifics();
const sync_pb::NigoriSpecifics& local_nigori = local_specifics.nigori();
// We initialize the new nigori with the server state, and will override
@@ -191,12 +183,10 @@ void ApplyNigoriUpdate(syncable::WriteTransaction* const trans,
// Always update to the safest set of encrypted types.
trans->directory()->GetNigoriHandler()->UpdateNigoriFromEncryptedTypes(
- new_nigori,
- trans);
+ new_nigori, trans);
entry->PutSpecifics(new_specifics);
- DVLOG(1) << "Resolving simple conflict, merging nigori nodes: "
- << entry;
+ DVLOG(1) << "Resolving simple conflict, merging nigori nodes: " << entry;
conflict_util::OverwriteServerChanges(entry);
@@ -212,7 +202,7 @@ void ApplyControlUpdate(syncable::WriteTransaction* const trans,
DCHECK_NE(entry->GetServerModelType(), NIGORI);
DCHECK(entry->GetIsUnappliedUpdate());
if (entry->GetIsUnsynced()) {
- // We just let the server win all conflicts with control types.
+ // We just let the server win all conflicts with control types.
DVLOG(1) << "Ignoring local changes for control update.";
conflict_util::IgnoreLocalChanges(entry);
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
@@ -220,8 +210,8 @@ void ApplyControlUpdate(syncable::WriteTransaction* const trans,
ConflictResolver::CONFLICT_RESOLUTION_SIZE);
}
- UpdateAttemptResponse response = AttemptToUpdateEntry(
- trans, entry, cryptographer);
+ UpdateAttemptResponse response =
+ AttemptToUpdateEntry(trans, entry, cryptographer);
DCHECK_EQ(SUCCESS, response);
}

Powered by Google App Engine
This is Rietveld 408576698