| 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 21 matching lines...) Expand all Loading... |
| 32 return true; | 32 return true; |
| 33 } | 33 } |
| 34 | 34 |
| 35 if (!db_is_on_disk_) { | 35 if (!db_is_on_disk_) { |
| 36 if (!base::DeleteFile(backing_filepath_, false)) | 36 if (!base::DeleteFile(backing_filepath_, false)) |
| 37 return false; | 37 return false; |
| 38 | 38 |
| 39 // Reopen DB on disk. | 39 // Reopen DB on disk. |
| 40 db_.reset(new sql::Connection); | 40 db_.reset(new sql::Connection); |
| 41 db_->set_exclusive_locking(); | 41 db_->set_exclusive_locking(); |
| 42 db_->set_page_size(4096); | 42 db_->set_page_size(databasePageSize_); |
| 43 if (!db_->Open(backing_filepath_) || !InitializeTables()) | 43 if (!db_->Open(backing_filepath_) || !InitializeTables()) |
| 44 return false; | 44 return false; |
| 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( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 65 if (!LoadEntries(handles_map, metahandles_to_purge)) | 65 if (!LoadEntries(handles_map, metahandles_to_purge)) |
| 66 return FAILED_DATABASE_CORRUPT; | 66 return FAILED_DATABASE_CORRUPT; |
| 67 if (!LoadInfo(kernel_load_info)) | 67 if (!LoadInfo(kernel_load_info)) |
| 68 return FAILED_DATABASE_CORRUPT; | 68 return FAILED_DATABASE_CORRUPT; |
| 69 | 69 |
| 70 return OPENED; | 70 return OPENED; |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace syncable | 73 } // namespace syncable |
| 74 } // namespace syncer | 74 } // namespace syncer |
| OLD | NEW |