OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/sync/engine/apply_updates_command.h" |
| 6 |
| 7 #include "chrome/browser/sync/engine/syncer_session.h" |
| 8 #include "chrome/browser/sync/engine/update_applicator.h" |
| 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 10 #include "chrome/browser/sync/syncable/syncable.h" |
| 11 #include "chrome/browser/sync/util/sync_types.h" |
| 12 |
| 13 namespace browser_sync { |
| 14 |
| 15 ApplyUpdatesCommand::ApplyUpdatesCommand() {} |
| 16 ApplyUpdatesCommand::~ApplyUpdatesCommand() {} |
| 17 |
| 18 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncerSession *session) { |
| 19 syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); |
| 20 if (!dir.good()) { |
| 21 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 22 return; |
| 23 } |
| 24 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__); |
| 25 syncable::Directory::UnappliedUpdateMetaHandles handles; |
| 26 dir->GetUnappliedUpdateMetaHandles(&trans, &handles); |
| 27 |
| 28 UpdateApplicator applicator(session, handles.begin(), handles.end()); |
| 29 while (applicator.AttemptOneApplication(&trans)) { |
| 30 } |
| 31 applicator.SaveProgressIntoSessionState(); |
| 32 } |
| 33 |
| 34 } // namespace browser_sync |
OLD | NEW |