| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ | 5 #ifndef SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ |
| 6 #define SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ | 6 #define SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "sync/base/sync_export.h" |
| 9 #include "sync/syncable/directory_backing_store.h" | 10 #include "sync/syncable/directory_backing_store.h" |
| 10 | 11 |
| 11 namespace syncer { | 12 namespace syncer { |
| 12 namespace syncable { | 13 namespace syncable { |
| 13 | 14 |
| 14 // This is the concrete class that provides a useful implementation of | 15 // This is the concrete class that provides a useful implementation of |
| 15 // DirectoryBackingStore. | 16 // DirectoryBackingStore. |
| 16 class OnDiskDirectoryBackingStore : public DirectoryBackingStore { | 17 class SYNC_EXPORT_PRIVATE OnDiskDirectoryBackingStore |
| 18 : public DirectoryBackingStore { |
| 17 public: | 19 public: |
| 18 OnDiskDirectoryBackingStore(const std::string& dir_name, | 20 OnDiskDirectoryBackingStore(const std::string& dir_name, |
| 19 const FilePath& backing_filepath); | 21 const FilePath& backing_filepath); |
| 20 virtual ~OnDiskDirectoryBackingStore(); | 22 virtual ~OnDiskDirectoryBackingStore(); |
| 21 virtual DirOpenResult Load( | 23 virtual DirOpenResult Load( |
| 22 MetahandlesIndex* entry_bucket, | 24 MetahandlesIndex* entry_bucket, |
| 23 Directory::KernelLoadInfo* kernel_load_info) OVERRIDE; | 25 Directory::KernelLoadInfo* kernel_load_info) OVERRIDE; |
| 24 | 26 |
| 25 // A helper function that will make one attempt to load the directory. | 27 // A helper function that will make one attempt to load the directory. |
| 26 // Unlike Load(), it does not attempt to recover from failure. | 28 // Unlike Load(), it does not attempt to recover from failure. |
| 27 DirOpenResult TryLoad( | 29 DirOpenResult TryLoad( |
| 28 MetahandlesIndex* entry_bucket, | 30 MetahandlesIndex* entry_bucket, |
| 29 Directory::KernelLoadInfo* kernel_load_info); | 31 Directory::KernelLoadInfo* kernel_load_info); |
| 30 | 32 |
| 31 protected: | 33 protected: |
| 32 // Subclasses may override this to avoid a possible DCHECK. | 34 // Subclasses may override this to avoid a possible DCHECK. |
| 33 virtual void ReportFirstTryOpenFailure(); | 35 virtual void ReportFirstTryOpenFailure(); |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MinorCorruption); | 38 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MinorCorruption); |
| 37 | 39 |
| 38 bool allow_failure_for_test_; | 40 bool allow_failure_for_test_; |
| 39 FilePath backing_filepath_; | 41 FilePath backing_filepath_; |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 } // namespace syncable | 44 } // namespace syncable |
| 43 } // namespace syncer | 45 } // namespace syncer |
| 44 | 46 |
| 45 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ | 47 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ |
| OLD | NEW |