| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "chrome/browser/sync/engine/update_applicator.h" | 8 #include "chrome/browser/sync/engine/update_applicator.h" |
| 9 #include "chrome/browser/sync/sessions/sync_session.h" | 9 #include "chrome/browser/sync/sessions/sync_session.h" |
| 10 #include "chrome/browser/sync/syncable/directory_manager.h" | 10 #include "chrome/browser/sync/syncable/directory_manager.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 for (syncable::FullModelTypeSet::Iterator it = | 38 for (syncable::FullModelTypeSet::Iterator it = |
| 39 server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { | 39 server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { |
| 40 groups_with_unapplied_updates.insert( | 40 groups_with_unapplied_updates.insert( |
| 41 GetGroupForModelType(it.Get(), session.routing_info())); | 41 GetGroupForModelType(it.Get(), session.routing_info())); |
| 42 } | 42 } |
| 43 | 43 |
| 44 return groups_with_unapplied_updates; | 44 return groups_with_unapplied_updates; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { | 47 SyncerError ApplyUpdatesCommand::ModelChangingExecuteImpl( |
| 48 SyncSession* session) { |
| 48 syncable::ScopedDirLookup dir(session->context()->directory_manager(), | 49 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
| 49 session->context()->account_name()); | 50 session->context()->account_name()); |
| 50 if (!dir.good()) { | 51 if (!dir.good()) { |
| 51 LOG(ERROR) << "Scoped dir lookup failed!"; | 52 LOG(ERROR) << "Scoped dir lookup failed!"; |
| 52 return; | 53 return DIRECTORY_LOOKUP_FAILED; |
| 53 } | 54 } |
| 54 | 55 |
| 55 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); | 56 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); |
| 56 | 57 |
| 57 // Compute server types with unapplied updates that fall under our | 58 // Compute server types with unapplied updates that fall under our |
| 58 // group restriction. | 59 // group restriction. |
| 59 const syncable::FullModelTypeSet server_types_with_unapplied_updates = | 60 const syncable::FullModelTypeSet server_types_with_unapplied_updates = |
| 60 dir->GetServerTypesWithUnappliedUpdates(&trans); | 61 dir->GetServerTypesWithUnappliedUpdates(&trans); |
| 61 syncable::FullModelTypeSet server_type_restriction; | 62 syncable::FullModelTypeSet server_type_restriction; |
| 62 for (syncable::FullModelTypeSet::Iterator it = | 63 for (syncable::FullModelTypeSet::Iterator it = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 84 // This might be the first time we've fully completed a sync cycle, for | 85 // This might be the first time we've fully completed a sync cycle, for |
| 85 // some subset of the currently synced datatypes. | 86 // some subset of the currently synced datatypes. |
| 86 const sessions::StatusController& status(session->status_controller()); | 87 const sessions::StatusController& status(session->status_controller()); |
| 87 if (status.ServerSaysNothingMoreToDownload()) { | 88 if (status.ServerSaysNothingMoreToDownload()) { |
| 88 for (syncable::ModelTypeSet::Iterator it = | 89 for (syncable::ModelTypeSet::Iterator it = |
| 89 status.updates_request_types().First(); it.Good(); it.Inc()) { | 90 status.updates_request_types().First(); it.Good(); it.Inc()) { |
| 90 // This gets persisted to the directory's backing store. | 91 // This gets persisted to the directory's backing store. |
| 91 dir->set_initial_sync_ended_for_type(it.Get(), true); | 92 dir->set_initial_sync_ended_for_type(it.Get(), true); |
| 92 } | 93 } |
| 93 } | 94 } |
| 95 |
| 96 return NO_ERROR; |
| 94 } | 97 } |
| 95 | 98 |
| 96 } // namespace browser_sync | 99 } // namespace browser_sync |
| OLD | NEW |