Chromium Code Reviews

Side by Side Diff: chrome/browser/sync/engine/apply_updates_command.cc

Issue 351026: Remove context-based dependencies on SyncerSession from ApplyUpdatesCommand.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
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" 7 #include "chrome/browser/sync/engine/syncer_session.h"
8 #include "chrome/browser/sync/engine/update_applicator.h" 8 #include "chrome/browser/sync/engine/update_applicator.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 ApplyUpdatesCommand::ApplyUpdatesCommand() {} 15 ApplyUpdatesCommand::ApplyUpdatesCommand() {}
16 ApplyUpdatesCommand::~ApplyUpdatesCommand() {} 16 ApplyUpdatesCommand::~ApplyUpdatesCommand() {}
17 17
18 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncerSession *session) { 18 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncerSession *session) {
19 syncable::ScopedDirLookup dir(session->dirman(), session->account_name()); 19 syncable::ScopedDirLookup dir(session->dirman(), session->account_name());
20 if (!dir.good()) { 20 if (!dir.good()) {
21 LOG(ERROR) << "Scoped dir lookup failed!"; 21 LOG(ERROR) << "Scoped dir lookup failed!";
22 return; 22 return;
23 } 23 }
24 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__); 24 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__);
25 syncable::Directory::UnappliedUpdateMetaHandles handles; 25 syncable::Directory::UnappliedUpdateMetaHandles handles;
26 dir->GetUnappliedUpdateMetaHandles(&trans, &handles); 26 dir->GetUnappliedUpdateMetaHandles(&trans, &handles);
27 27
28 UpdateApplicator applicator(session, handles.begin(), handles.end()); 28 UpdateApplicator applicator(session->resolver(), handles.begin(),
29 while (applicator.AttemptOneApplication(&trans)) { 29 handles.end());
30 } 30 while (applicator.AttemptOneApplication(&trans)) {}
31 applicator.SaveProgressIntoSessionState(); 31 applicator.SaveProgressIntoSessionState(session);
32 } 32 }
33 33
34 } // namespace browser_sync 34 } // namespace browser_sync
OLDNEW

Powered by Google App Engine