OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/tracked.h" |
7 #include "chrome/browser/sync/engine/update_applicator.h" | 8 #include "chrome/browser/sync/engine/update_applicator.h" |
8 #include "chrome/browser/sync/sessions/sync_session.h" | 9 #include "chrome/browser/sync/sessions/sync_session.h" |
9 #include "chrome/browser/sync/syncable/directory_manager.h" | 10 #include "chrome/browser/sync/syncable/directory_manager.h" |
10 #include "chrome/browser/sync/syncable/syncable.h" | 11 #include "chrome/browser/sync/syncable/syncable.h" |
11 | 12 |
12 namespace browser_sync { | 13 namespace browser_sync { |
13 | 14 |
14 using sessions::SyncSession; | 15 using sessions::SyncSession; |
15 | 16 |
16 ApplyUpdatesCommand::ApplyUpdatesCommand() {} | 17 ApplyUpdatesCommand::ApplyUpdatesCommand() {} |
17 ApplyUpdatesCommand::~ApplyUpdatesCommand() {} | 18 ApplyUpdatesCommand::~ApplyUpdatesCommand() {} |
18 | 19 |
19 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { | 20 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { |
20 syncable::ScopedDirLookup dir(session->context()->directory_manager(), | 21 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
21 session->context()->account_name()); | 22 session->context()->account_name()); |
22 if (!dir.good()) { | 23 if (!dir.good()) { |
23 LOG(ERROR) << "Scoped dir lookup failed!"; | 24 LOG(ERROR) << "Scoped dir lookup failed!"; |
24 return; | 25 return; |
25 } | 26 } |
26 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__); | 27 syncable::WriteTransaction trans(dir, syncable::SYNCER, FROM_HERE); |
27 syncable::Directory::UnappliedUpdateMetaHandles handles; | 28 syncable::Directory::UnappliedUpdateMetaHandles handles; |
28 dir->GetUnappliedUpdateMetaHandles(&trans, &handles); | 29 dir->GetUnappliedUpdateMetaHandles(&trans, &handles); |
29 | 30 |
30 UpdateApplicator applicator( | 31 UpdateApplicator applicator( |
31 session->context()->resolver(), | 32 session->context()->resolver(), |
32 session->context()->directory_manager()->GetCryptographer(&trans), | 33 session->context()->directory_manager()->GetCryptographer(&trans), |
33 handles.begin(), handles.end(), session->routing_info(), | 34 handles.begin(), handles.end(), session->routing_info(), |
34 session->status_controller()->group_restriction()); | 35 session->status_controller()->group_restriction()); |
35 while (applicator.AttemptOneApplication(&trans)) {} | 36 while (applicator.AttemptOneApplication(&trans)) {} |
36 applicator.SaveProgressIntoSessionState( | 37 applicator.SaveProgressIntoSessionState( |
(...skipping 16 matching lines...) Expand all Loading... |
53 syncable::ModelType model_type = syncable::ModelTypeFromInt(i); | 54 syncable::ModelType model_type = syncable::ModelTypeFromInt(i); |
54 if (status->updates_request_types()[i]) { | 55 if (status->updates_request_types()[i]) { |
55 // This gets persisted to the directory's backing store. | 56 // This gets persisted to the directory's backing store. |
56 dir->set_initial_sync_ended_for_type(model_type, true); | 57 dir->set_initial_sync_ended_for_type(model_type, true); |
57 } | 58 } |
58 } | 59 } |
59 } | 60 } |
60 } | 61 } |
61 | 62 |
62 } // namespace browser_sync | 63 } // namespace browser_sync |
OLD | NEW |