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

Unified Diff: sync/engine/apply_updates_command.cc

Issue 9950137: [not for review] sync: Don't use group_restriction from ApplyUpdatesCommand. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « no previous file | sync/engine/model_safe_worker.h » ('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
index 79fd039ba2312e35e647fb65368b519692482aad..f03f2611a785cf6b831f290b6e09b68a2c2248b0 100644
--- a/sync/engine/apply_updates_command.cc
+++ b/sync/engine/apply_updates_command.cc
@@ -18,63 +18,33 @@ 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;
+ return session.status_controller().GetModelSafeGroupsWithUnappliedUpdates();
}
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());
- }
- }
-
- std::vector<int64> handles;
- dir->GetUnappliedUpdateMetaHandles(
- &trans, server_type_restriction, &handles);
+ sessions::StatusController* status =
+ session->mutable_status_controller();
UpdateApplicator applicator(
session->context()->resolver(),
dir->GetCryptographer(&trans),
- handles.begin(), handles.end(), session->routing_info(),
- session->status_controller().group_restriction());
+ status->mutable_update_progress()->unapplied_updates()->begin(),
+ status->mutable_update_progress()->unapplied_updates()->end(),
+ session->routing_info(),
+ status->group_restriction());
while (applicator.AttemptOneApplication(&trans)) {}
applicator.SaveProgressIntoSessionState(
- session->mutable_status_controller()->mutable_conflict_progress(),
- session->mutable_status_controller()->mutable_update_progress());
+ status->mutable_conflict_progress(),
+ status->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()) {
+ if (status->ServerSaysNothingMoreToDownload()) {
for (syncable::ModelTypeSet::Iterator it =
- status.updates_request_types().First(); it.Good(); it.Inc()) {
+ 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);
}
« no previous file with comments | « no previous file | sync/engine/model_safe_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698