| 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 "components/sync/syncable/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/stl_util.h" | 9 #include "base/stl_util.h" |
| 9 #include "base/metrics/histogram.h" | 10 #include "components/sync/syncable/syncable-inl.h" |
| 10 #include "sync/syncable/syncable-inl.h" | |
| 11 | 11 |
| 12 namespace syncer { | 12 namespace syncer { |
| 13 namespace syncable { | 13 namespace syncable { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 enum HistogramResultEnum { | 17 enum HistogramResultEnum { |
| 18 FIRST_TRY_SUCCESS, | 18 FIRST_TRY_SUCCESS, |
| 19 SECOND_TRY_SUCCESS, | 19 SECOND_TRY_SUCCESS, |
| 20 SECOND_TRY_FAILURE, | 20 SECOND_TRY_FAILURE, |
| 21 RESULT_COUNT | 21 RESULT_COUNT |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 OnDiskDirectoryBackingStore::OnDiskDirectoryBackingStore( | 26 OnDiskDirectoryBackingStore::OnDiskDirectoryBackingStore( |
| 27 const std::string& dir_name, | 27 const std::string& dir_name, |
| 28 const base::FilePath& backing_file_path) | 28 const base::FilePath& backing_file_path) |
| 29 : DirectoryBackingStore(dir_name), backing_file_path_(backing_file_path) { | 29 : DirectoryBackingStore(dir_name), backing_file_path_(backing_file_path) { |
| 30 DCHECK(backing_file_path_.IsAbsolute()); | 30 DCHECK(backing_file_path_.IsAbsolute()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() { | 33 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() {} |
| 34 } | |
| 35 | 34 |
| 36 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( | 35 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( |
| 37 Directory::MetahandlesMap* handles_map, | 36 Directory::MetahandlesMap* handles_map, |
| 38 JournalIndex* delete_journals, | 37 JournalIndex* delete_journals, |
| 39 MetahandleSet* metahandles_to_purge, | 38 MetahandleSet* metahandles_to_purge, |
| 40 Directory::KernelLoadInfo* kernel_load_info) { | 39 Directory::KernelLoadInfo* kernel_load_info) { |
| 41 DCHECK(CalledOnValidThread()); | 40 DCHECK(CalledOnValidThread()); |
| 42 | 41 |
| 43 if (!IsOpen()) { | 42 if (!IsOpen()) { |
| 44 if (!Open(backing_file_path_)) | 43 if (!Open(backing_file_path_)) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 NOTREACHED() << "Crashing to preserve corrupt sync database"; | 109 NOTREACHED() << "Crashing to preserve corrupt sync database"; |
| 111 } | 110 } |
| 112 | 111 |
| 113 const base::FilePath& OnDiskDirectoryBackingStore::backing_file_path() const { | 112 const base::FilePath& OnDiskDirectoryBackingStore::backing_file_path() const { |
| 114 DCHECK(CalledOnValidThread()); | 113 DCHECK(CalledOnValidThread()); |
| 115 return backing_file_path_; | 114 return backing_file_path_; |
| 116 } | 115 } |
| 117 | 116 |
| 118 } // namespace syncable | 117 } // namespace syncable |
| 119 } // namespace syncer | 118 } // namespace syncer |
| OLD | NEW |