| 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" |
| 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), |
| 30 DCHECK(backing_file_path_.IsAbsolute()); | 30 allow_failure_for_test_(false), |
| 31 backing_file_path_(backing_file_path) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() { | 34 OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() { |
| 34 } | 35 } |
| 35 | 36 |
| 36 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( | 37 DirOpenResult OnDiskDirectoryBackingStore::TryLoad( |
| 37 Directory::MetahandlesMap* handles_map, | 38 Directory::MetahandlesMap* handles_map, |
| 38 JournalIndex* delete_journals, | 39 JournalIndex* delete_journals, |
| 39 MetahandleSet* metahandles_to_purge, | 40 MetahandleSet* metahandles_to_purge, |
| 40 Directory::KernelLoadInfo* kernel_load_info) { | 41 Directory::KernelLoadInfo* kernel_load_info) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 NOTREACHED() << "Crashing to preserve corrupt sync database"; | 111 NOTREACHED() << "Crashing to preserve corrupt sync database"; |
| 111 } | 112 } |
| 112 | 113 |
| 113 const base::FilePath& OnDiskDirectoryBackingStore::backing_file_path() const { | 114 const base::FilePath& OnDiskDirectoryBackingStore::backing_file_path() const { |
| 114 DCHECK(CalledOnValidThread()); | 115 DCHECK(CalledOnValidThread()); |
| 115 return backing_file_path_; | 116 return backing_file_path_; |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace syncable | 119 } // namespace syncable |
| 119 } // namespace syncer | 120 } // namespace syncer |
| OLD | NEW |