| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync/engine/apply_updates_command.h" | 5 #include "chrome/browser/sync/engine/apply_updates_command.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/engine/syncer_session.h" | |
| 8 #include "chrome/browser/sync/engine/update_applicator.h" | 7 #include "chrome/browser/sync/engine/update_applicator.h" |
| 8 #include "chrome/browser/sync/sessions/sync_session.h" |
| 9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 10 #include "chrome/browser/sync/syncable/syncable.h" | 10 #include "chrome/browser/sync/syncable/syncable.h" |
| 11 #include "chrome/browser/sync/util/sync_types.h" | 11 #include "chrome/browser/sync/util/sync_types.h" |
| 12 | 12 |
| 13 namespace browser_sync { | 13 namespace browser_sync { |
| 14 | 14 |
| 15 using sessions::SyncSession; |
| 16 |
| 15 ApplyUpdatesCommand::ApplyUpdatesCommand() {} | 17 ApplyUpdatesCommand::ApplyUpdatesCommand() {} |
| 16 ApplyUpdatesCommand::~ApplyUpdatesCommand() {} | 18 ApplyUpdatesCommand::~ApplyUpdatesCommand() {} |
| 17 | 19 |
| 18 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncerSession *session) { | 20 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { |
| 19 syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); | 21 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
| 22 session->context()->account_name()); |
| 20 if (!dir.good()) { | 23 if (!dir.good()) { |
| 21 LOG(ERROR) << "Scoped dir lookup failed!"; | 24 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 22 return; | 25 return; |
| 23 } | 26 } |
| 24 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__); | 27 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__); |
| 25 syncable::Directory::UnappliedUpdateMetaHandles handles; | 28 syncable::Directory::UnappliedUpdateMetaHandles handles; |
| 26 dir->GetUnappliedUpdateMetaHandles(&trans, &handles); | 29 dir->GetUnappliedUpdateMetaHandles(&trans, &handles); |
| 27 | 30 |
| 28 UpdateApplicator applicator(session->resolver(), handles.begin(), | 31 UpdateApplicator applicator(session->context()->resolver(), handles.begin(), |
| 29 handles.end()); | 32 handles.end()); |
| 30 while (applicator.AttemptOneApplication(&trans)) {} | 33 while (applicator.AttemptOneApplication(&trans)) {} |
| 31 applicator.SaveProgressIntoSessionState(session); | 34 applicator.SaveProgressIntoSessionState( |
| 35 session->status_controller()->mutable_conflict_progress(), |
| 36 session->status_controller()->mutable_update_progress()); |
| 32 } | 37 } |
| 33 | 38 |
| 34 } // namespace browser_sync | 39 } // namespace browser_sync |
| OLD | NEW |