| 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_base.h" | 5 #include "sync/internal_api/sync_rollback_manager_base.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/write_transaction.h" | 10 #include "sync/internal_api/public/write_transaction.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 weak_ptr_factory_(this) { | 42 weak_ptr_factory_(this) { |
| 43 } | 43 } |
| 44 | 44 |
| 45 SyncRollbackManagerBase::~SyncRollbackManagerBase() { | 45 SyncRollbackManagerBase::~SyncRollbackManagerBase() { |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool SyncRollbackManagerBase::InitInternal( | 48 bool SyncRollbackManagerBase::InitInternal( |
| 49 const base::FilePath& database_location, | 49 const base::FilePath& database_location, |
| 50 InternalComponentsFactory* internal_components_factory, | 50 InternalComponentsFactory* internal_components_factory, |
| 51 InternalComponentsFactory::StorageOption storage, | 51 InternalComponentsFactory::StorageOption storage, |
| 52 scoped_ptr<UnrecoverableErrorHandler> unrecoverable_error_handler, | 52 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, |
| 53 const base::Closure& report_unrecoverable_error_function) { | 53 const base::Closure& report_unrecoverable_error_function) { |
| 54 unrecoverable_error_handler_ = unrecoverable_error_handler.Pass(); | 54 unrecoverable_error_handler_ = unrecoverable_error_handler; |
| 55 report_unrecoverable_error_function_ = report_unrecoverable_error_function; | 55 report_unrecoverable_error_function_ = report_unrecoverable_error_function; |
| 56 | 56 |
| 57 if (!InitBackupDB(database_location, internal_components_factory, storage)) { | 57 if (!InitBackupDB(database_location, internal_components_factory, storage)) { |
| 58 NotifyInitializationFailure(); | 58 NotifyInitializationFailure(); |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 initialized_ = true; | 62 initialized_ = true; |
| 63 NotifyInitializationSuccess(); | 63 NotifyInitializationSuccess(); |
| 64 return true; | 64 return true; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 base::FilePath backup_db_path = sync_folder.Append( | 238 base::FilePath backup_db_path = sync_folder.Append( |
| 239 syncable::Directory::kSyncDatabaseFilename); | 239 syncable::Directory::kSyncDatabaseFilename); |
| 240 scoped_ptr<syncable::DirectoryBackingStore> backing_store = | 240 scoped_ptr<syncable::DirectoryBackingStore> backing_store = |
| 241 internal_components_factory->BuildDirectoryBackingStore( | 241 internal_components_factory->BuildDirectoryBackingStore( |
| 242 storage, "backup", backup_db_path).Pass(); | 242 storage, "backup", backup_db_path).Pass(); |
| 243 | 243 |
| 244 DCHECK(backing_store.get()); | 244 DCHECK(backing_store.get()); |
| 245 share_.directory.reset( | 245 share_.directory.reset( |
| 246 new syncable::Directory( | 246 new syncable::Directory( |
| 247 backing_store.release(), | 247 backing_store.release(), |
| 248 unrecoverable_error_handler_.get(), | 248 unrecoverable_error_handler_, |
| 249 report_unrecoverable_error_function_, | 249 report_unrecoverable_error_function_, |
| 250 NULL, | 250 NULL, |
| 251 NULL)); | 251 NULL)); |
| 252 return syncable::OPENED == | 252 return syncable::OPENED == |
| 253 share_.directory->Open( | 253 share_.directory->Open( |
| 254 "backup", this, | 254 "backup", this, |
| 255 MakeWeakHandle(weak_ptr_factory_.GetWeakPtr())); | 255 MakeWeakHandle(weak_ptr_factory_.GetWeakPtr())); |
| 256 } | 256 } |
| 257 | 257 |
| 258 bool SyncRollbackManagerBase::InitTypeRootNode(ModelType type) { | 258 bool SyncRollbackManagerBase::InitTypeRootNode(ModelType type) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 bool SyncRollbackManagerBase::HasDirectoryTypeDebugInfoObserver( | 322 bool SyncRollbackManagerBase::HasDirectoryTypeDebugInfoObserver( |
| 323 syncer::TypeDebugInfoObserver* observer) { return false; } | 323 syncer::TypeDebugInfoObserver* observer) { return false; } |
| 324 | 324 |
| 325 void SyncRollbackManagerBase::RequestEmitDebugInfo() {} | 325 void SyncRollbackManagerBase::RequestEmitDebugInfo() {} |
| 326 | 326 |
| 327 void SyncRollbackManagerBase::ClearServerData( | 327 void SyncRollbackManagerBase::ClearServerData( |
| 328 const ClearServerDataCallback& callback) {} | 328 const ClearServerDataCallback& callback) {} |
| 329 | 329 |
| 330 } // namespace syncer | 330 } // namespace syncer |
| OLD | NEW |