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/syncable/deferred_on_disk_directory_backing_store.h" | 5 #include "sync/syncable/deferred_on_disk_directory_backing_store.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "sync/syncable/syncable-inl.h" | 10 #include "sync/syncable/syncable-inl.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 db_is_on_disk_ = true; | 46 db_is_on_disk_ = true; |
47 } | 47 } |
48 | 48 |
49 return DirectoryBackingStore::SaveChanges(snapshot); | 49 return DirectoryBackingStore::SaveChanges(snapshot); |
50 } | 50 } |
51 | 51 |
52 DirOpenResult DeferredOnDiskDirectoryBackingStore::Load( | 52 DirOpenResult DeferredOnDiskDirectoryBackingStore::Load( |
53 Directory::MetahandlesMap* handles_map, | 53 Directory::MetahandlesMap* handles_map, |
54 JournalIndex* delete_journals, | 54 JournalIndex* delete_journals, |
| 55 MetahandleSet* metahandles_to_purge, |
55 Directory::KernelLoadInfo* kernel_load_info) { | 56 Directory::KernelLoadInfo* kernel_load_info) { |
56 // Open an in-memory database at first to create initial sync data needed by | 57 // Open an in-memory database at first to create initial sync data needed by |
57 // Directory. | 58 // Directory. |
58 CHECK(!db_->is_open()); | 59 CHECK(!db_->is_open()); |
59 if (!db_->OpenInMemory()) | 60 if (!db_->OpenInMemory()) |
60 return FAILED_OPEN_DATABASE; | 61 return FAILED_OPEN_DATABASE; |
61 | 62 |
62 if (!InitializeTables()) | 63 if (!InitializeTables()) |
63 return FAILED_OPEN_DATABASE; | 64 return FAILED_OPEN_DATABASE; |
64 if (!LoadEntries(handles_map)) | 65 if (!LoadEntries(handles_map, metahandles_to_purge)) |
65 return FAILED_DATABASE_CORRUPT; | 66 return FAILED_DATABASE_CORRUPT; |
66 if (!LoadInfo(kernel_load_info)) | 67 if (!LoadInfo(kernel_load_info)) |
67 return FAILED_DATABASE_CORRUPT; | 68 return FAILED_DATABASE_CORRUPT; |
68 | 69 |
69 return OPENED; | 70 return OPENED; |
70 } | 71 } |
71 | 72 |
72 } // namespace syncable | 73 } // namespace syncable |
73 } // namespace syncer | 74 } // namespace syncer |
OLD | NEW |