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

Unified Diff: chrome/browser/sync/engine/apply_updates_command.cc

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 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: chrome/browser/sync/engine/apply_updates_command.cc
diff --git a/chrome/browser/sync/engine/apply_updates_command.cc b/chrome/browser/sync/engine/apply_updates_command.cc
deleted file mode 100644
index 89bf3fbb88cf45e34c69ae889b4916c599973e4f..0000000000000000000000000000000000000000
--- a/chrome/browser/sync/engine/apply_updates_command.cc
+++ /dev/null
@@ -1,86 +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 "chrome/browser/sync/engine/apply_updates_command.h"
-
-#include "base/location.h"
-#include "chrome/browser/sync/engine/update_applicator.h"
-#include "chrome/browser/sync/sessions/sync_session.h"
-#include "chrome/browser/sync/syncable/syncable.h"
-
-namespace browser_sync {
-
-using sessions::SyncSession;
-
-ApplyUpdatesCommand::ApplyUpdatesCommand() {}
-ApplyUpdatesCommand::~ApplyUpdatesCommand() {}
-
-std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange(
- const sessions::SyncSession& session) const {
- std::set<ModelSafeGroup> groups_with_unapplied_updates;
-
- syncable::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 (syncable::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 syncable::FullModelTypeSet server_types_with_unapplied_updates =
- dir->GetServerTypesWithUnappliedUpdates(&trans);
- syncable::FullModelTypeSet server_type_restriction;
- for (syncable::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());
- }
- }
-
- syncable::Directory::UnappliedUpdateMetaHandles handles;
- dir->GetUnappliedUpdateMetaHandles(
- &trans, server_type_restriction, &handles);
-
- UpdateApplicator applicator(
- session->context()->resolver(),
- dir->GetCryptographer(&trans),
- handles.begin(), handles.end(), session->routing_info(),
- session->status_controller().group_restriction());
- while (applicator.AttemptOneApplication(&trans)) {}
- applicator.SaveProgressIntoSessionState(
- session->mutable_status_controller()->mutable_conflict_progress(),
- session->mutable_status_controller()->mutable_update_progress());
-
- // 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 (syncable::ModelTypeSet::Iterator it =
- status.updates_request_types().First(); it.Good(); it.Inc()) {
- // This gets persisted to the directory's backing store.
- dir->set_initial_sync_ended_for_type(it.Get(), true);
- }
- }
-
- return SYNCER_OK;
-}
-
-} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/engine/apply_updates_command.h ('k') | chrome/browser/sync/engine/apply_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698