| 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/on_disk_directory_backing_store.h" | 5 #include "sync/syncable/on_disk_directory_backing_store.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "sync/syncable/syncable-inl.h" | 10 #include "sync/syncable/syncable-inl.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() { } | 33 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() { } |
| 34 | 34 |
| 35 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( | 35 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( |
| 36 Directory::MetahandlesMap* handles_map, | 36 Directory::MetahandlesMap* handles_map, |
| 37 JournalIndex* delete_journals, | 37 JournalIndex* delete_journals, |
| 38 MetahandleSet* metahandles_to_purge, | 38 MetahandleSet* metahandles_to_purge, |
| 39 Directory::KernelLoadInfo* kernel_load_info) { | 39 Directory::KernelLoadInfo* kernel_load_info) { |
| 40 DCHECK(CalledOnValidThread()); | 40 DCHECK(CalledOnValidThread()); |
| 41 if (!db_->is_open()) { | 41 |
| 42 if (!db_->Open(backing_filepath_)) | 42 if (!IsOpen()) { |
| 43 if (!Open(backing_filepath_)) |
| 43 return FAILED_OPEN_DATABASE; | 44 return FAILED_OPEN_DATABASE; |
| 44 } | 45 } |
| 45 | 46 |
| 46 if (!InitializeTables()) | 47 if (!InitializeTables()) |
| 47 return FAILED_OPEN_DATABASE; | 48 return FAILED_OPEN_DATABASE; |
| 48 | 49 |
| 49 if (!LoadEntries(handles_map, metahandles_to_purge)) | 50 if (!LoadEntries(handles_map, metahandles_to_purge)) |
| 50 return FAILED_DATABASE_CORRUPT; | 51 return FAILED_DATABASE_CORRUPT; |
| 51 if (!LoadDeleteJournals(delete_journals)) | 52 if (!LoadDeleteJournals(delete_journals)) |
| 52 return FAILED_DATABASE_CORRUPT; | 53 return FAILED_DATABASE_CORRUPT; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // immediately so a developer can investigate. | 104 // immediately so a developer can investigate. |
| 104 // | 105 // |
| 105 // Developers: If you're not interested in debugging this right now, just move | 106 // Developers: If you're not interested in debugging this right now, just move |
| 106 // aside the 'Sync Data' directory in your profile. This is similar to what | 107 // aside the 'Sync Data' directory in your profile. This is similar to what |
| 107 // the code would do if this DCHECK were disabled. | 108 // the code would do if this DCHECK were disabled. |
| 108 NOTREACHED() << "Crashing to preserve corrupt sync database"; | 109 NOTREACHED() << "Crashing to preserve corrupt sync database"; |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace syncable | 112 } // namespace syncable |
| 112 } // namespace syncer | 113 } // namespace syncer |
| OLD | NEW |