| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/syncable/in_memory_directory_backing_store.h" | 5 #include "sync/syncable/in_memory_directory_backing_store.h" |
| 6 | 6 |
| 7 namespace syncer { | 7 namespace syncer { |
| 8 namespace syncable { | 8 namespace syncable { |
| 9 | 9 |
| 10 InMemoryDirectoryBackingStore::InMemoryDirectoryBackingStore( | 10 InMemoryDirectoryBackingStore::InMemoryDirectoryBackingStore( |
| 11 const std::string& dir_name) : DirectoryBackingStore(dir_name) { | 11 const std::string& dir_name) : DirectoryBackingStore(dir_name) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 DirOpenResult InMemoryDirectoryBackingStore::Load( | 14 DirOpenResult InMemoryDirectoryBackingStore::Load( |
| 15 MetahandlesIndex* entry_bucket, | 15 MetahandlesIndex* entry_bucket, |
| 16 IdsIndex* delete_journals, |
| 16 Directory::KernelLoadInfo* kernel_load_info) { | 17 Directory::KernelLoadInfo* kernel_load_info) { |
| 17 if (!db_->is_open()) { | 18 if (!db_->is_open()) { |
| 18 if (!db_->OpenInMemory()) | 19 if (!db_->OpenInMemory()) |
| 19 return FAILED_OPEN_DATABASE; | 20 return FAILED_OPEN_DATABASE; |
| 20 } | 21 } |
| 21 | 22 |
| 22 if (!InitializeTables()) | 23 if (!InitializeTables()) |
| 23 return FAILED_OPEN_DATABASE; | 24 return FAILED_OPEN_DATABASE; |
| 24 | 25 |
| 25 if (!DropDeletedEntries()) | 26 if (!DropDeletedEntries()) |
| 26 return FAILED_DATABASE_CORRUPT; | 27 return FAILED_DATABASE_CORRUPT; |
| 27 if (!LoadEntries(entry_bucket)) | 28 if (!LoadEntries(entry_bucket)) |
| 28 return FAILED_DATABASE_CORRUPT; | 29 return FAILED_DATABASE_CORRUPT; |
| 30 if (!LoadDeleteJournals(delete_journals)) |
| 31 return FAILED_DATABASE_CORRUPT; |
| 29 if (!LoadInfo(kernel_load_info)) | 32 if (!LoadInfo(kernel_load_info)) |
| 30 return FAILED_DATABASE_CORRUPT; | 33 return FAILED_DATABASE_CORRUPT; |
| 31 if (!VerifyReferenceIntegrity(*entry_bucket)) | 34 if (!VerifyReferenceIntegrity(*entry_bucket)) |
| 32 return FAILED_DATABASE_CORRUPT; | 35 return FAILED_DATABASE_CORRUPT; |
| 33 | 36 |
| 34 return OPENED; | 37 return OPENED; |
| 35 } | 38 } |
| 36 | 39 |
| 37 } // namespace syncable | 40 } // namespace syncable |
| 38 } // namespace syncer | 41 } // namespace syncer |
| OLD | NEW |