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

Unified Diff: sync/engine/apply_updates_command.cc

Issue 11192071: sync: Merge apply updates and resolve conflicts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Retry (base files were missing) Created 8 years, 2 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
« no previous file with comments | « sync/engine/apply_updates_command.h ('k') | sync/engine/apply_updates_command_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/apply_updates_command.cc
diff --git a/sync/engine/apply_updates_command.cc b/sync/engine/apply_updates_command.cc
deleted file mode 100644
index bff83f2260a345a79349c1d7b87cbe2c1ed4a9f5..0000000000000000000000000000000000000000
--- a/sync/engine/apply_updates_command.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "sync/engine/apply_updates_command.h"
-
-#include "base/location.h"
-#include "sync/engine/update_applicator.h"
-#include "sync/sessions/sync_session.h"
-#include "sync/syncable/directory.h"
-#include "sync/syncable/read_transaction.h"
-#include "sync/syncable/write_transaction.h"
-
-namespace syncer {
-
-using sessions::SyncSession;
-
-ApplyUpdatesCommand::ApplyUpdatesCommand() {}
-ApplyUpdatesCommand::~ApplyUpdatesCommand() {}
-
-std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange(
- const sessions::SyncSession& session) const {
- std::set<ModelSafeGroup> groups_with_unapplied_updates;
-
- FullModelTypeSet server_types_with_unapplied_updates;
- {
- syncable::Directory* dir = session.context()->directory();
- syncable::ReadTransaction trans(FROM_HERE, dir);
- server_types_with_unapplied_updates =
- dir->GetServerTypesWithUnappliedUpdates(&trans);
- }
-
- for (FullModelTypeSet::Iterator it =
- server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) {
- groups_with_unapplied_updates.insert(
- GetGroupForModelType(it.Get(), session.routing_info()));
- }
-
- return groups_with_unapplied_updates;
-}
-
-SyncerError ApplyUpdatesCommand::ModelChangingExecuteImpl(
- SyncSession* session) {
- syncable::Directory* dir = session->context()->directory();
- syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir);
-
- // Compute server types with unapplied updates that fall under our
- // group restriction.
- const FullModelTypeSet server_types_with_unapplied_updates =
- dir->GetServerTypesWithUnappliedUpdates(&trans);
- FullModelTypeSet server_type_restriction;
- for (FullModelTypeSet::Iterator it =
- server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) {
- if (GetGroupForModelType(it.Get(), session->routing_info()) ==
- session->status_controller().group_restriction()) {
- server_type_restriction.Put(it.Get());
- }
- }
-
- // Don't process control type updates here. They will be handled elsewhere.
- FullModelTypeSet control_types = ToFullModelTypeSet(ControlTypes());
- server_type_restriction.RemoveAll(control_types);
-
- std::vector<int64> handles;
- dir->GetUnappliedUpdateMetaHandles(
- &trans, server_type_restriction, &handles);
-
- UpdateApplicator applicator(
- dir->GetCryptographer(&trans),
- session->routing_info(),
- session->status_controller().group_restriction());
- applicator.AttemptApplications(&trans, handles,
- session->mutable_status_controller());
-
- // This might be the first time we've fully completed a sync cycle, for
- // some subset of the currently synced datatypes.
- const sessions::StatusController& status(session->status_controller());
- if (status.ServerSaysNothingMoreToDownload()) {
- for (ModelTypeSet::Iterator it =
- status.updates_request_types().First(); it.Good(); it.Inc()) {
- // Don't set the flag for control types. We didn't process them here.
- if (IsControlType(it.Get()))
- continue;
-
- // This gets persisted to the directory's backing store.
- dir->set_initial_sync_ended_for_type(it.Get(), true);
- }
- }
-
- return SYNCER_OK;
-}
-
-} // namespace syncer
« no previous file with comments | « sync/engine/apply_updates_command.h ('k') | sync/engine/apply_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698