| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/internal_api/sync_rollback_manager.h" | 5 #include "sync/internal_api/sync_rollback_manager.h" | 
| 6 | 6 | 
| 7 #include "sync/internal_api/public/base/model_type.h" | 7 #include "sync/internal_api/public/base/model_type.h" | 
| 8 #include "sync/internal_api/public/read_node.h" | 8 #include "sync/internal_api/public/read_node.h" | 
| 9 #include "sync/internal_api/public/read_transaction.h" | 9 #include "sync/internal_api/public/read_transaction.h" | 
| 10 #include "sync/internal_api/public/util/syncer_error.h" | 10 #include "sync/internal_api/public/util/syncer_error.h" | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 46                                 use_ssl, post_factory.Pass(), | 46                                 use_ssl, post_factory.Pass(), | 
| 47                                 workers, extensions_activity, change_delegate, | 47                                 workers, extensions_activity, change_delegate, | 
| 48                                 credentials, invalidator_client_id, | 48                                 credentials, invalidator_client_id, | 
| 49                                 restored_key_for_bootstrapping, | 49                                 restored_key_for_bootstrapping, | 
| 50                                 restored_keystore_key_for_bootstrapping, | 50                                 restored_keystore_key_for_bootstrapping, | 
| 51                                 internal_components_factory, encryptor, | 51                                 internal_components_factory, encryptor, | 
| 52                                 unrecoverable_error_handler.Pass(), | 52                                 unrecoverable_error_handler.Pass(), | 
| 53                                 report_unrecoverable_error_function, | 53                                 report_unrecoverable_error_function, | 
| 54                                 cancelation_signal); | 54                                 cancelation_signal); | 
| 55 | 55 | 
| 56   change_delegate_ = change_delegate; | 56   if (initialized()) { | 
|  | 57     change_delegate_ = change_delegate; | 
| 57 | 58 | 
| 58   for (size_t i = 0; i < workers.size(); ++i) { | 59     for (size_t i = 0; i < workers.size(); ++i) { | 
| 59     ModelSafeGroup group = workers[i]->GetModelSafeGroup(); | 60       ModelSafeGroup group = workers[i]->GetModelSafeGroup(); | 
| 60     CHECK(workers_.find(group) == workers_.end()); | 61       CHECK(workers_.find(group) == workers_.end()); | 
| 61     workers_[group] = workers[i]; | 62       workers_[group] = workers[i]; | 
|  | 63     } | 
|  | 64 | 
|  | 65     rollback_ready_types_ = GetUserShare()->directory->InitialSyncEndedTypes(); | 
|  | 66     rollback_ready_types_.RetainAll(BackupTypes()); | 
| 62   } | 67   } | 
| 63 |  | 
| 64   rollback_ready_types_ = GetUserShare()->directory->InitialSyncEndedTypes(); |  | 
| 65   rollback_ready_types_.RetainAll(BackupTypes()); |  | 
| 66 } | 68 } | 
| 67 | 69 | 
| 68 void SyncRollbackManager::StartSyncingNormally( | 70 void SyncRollbackManager::StartSyncingNormally( | 
| 69     const ModelSafeRoutingInfo& routing_info){ | 71     const ModelSafeRoutingInfo& routing_info){ | 
| 70   if (rollback_ready_types_.Empty()) { | 72   if (rollback_ready_types_.Empty()) { | 
| 71     NotifyRollbackDone(); | 73     NotifyRollbackDone(); | 
| 72     return; | 74     return; | 
| 73   } | 75   } | 
| 74 | 76 | 
| 75   std::map<ModelType, syncable::Directory::Metahandles> to_delete; | 77   std::map<ModelType, syncable::Directory::Metahandles> to_delete; | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 137 } | 139 } | 
| 138 | 140 | 
| 139 void SyncRollbackManager::NotifyRollbackDone() { | 141 void SyncRollbackManager::NotifyRollbackDone() { | 
| 140   SyncProtocolError error; | 142   SyncProtocolError error; | 
| 141   error.action = ROLLBACK_DONE; | 143   error.action = ROLLBACK_DONE; | 
| 142   FOR_EACH_OBSERVER(SyncManager::Observer, *GetObservers(), | 144   FOR_EACH_OBSERVER(SyncManager::Observer, *GetObservers(), | 
| 143                     OnActionableError(error)); | 145                     OnActionableError(error)); | 
| 144 } | 146 } | 
| 145 | 147 | 
| 146 }  // namespace syncer | 148 }  // namespace syncer | 
| OLD | NEW | 
|---|