ChildAccountService: get service flags from AccountTrackerService instead of fetching...
[chromium-blink-merge.git] / sync / syncable / on_disk_directory_backing_store.h
blob05f4156f5f1ec3d9c16167c1da541d16162f1d21
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
3 // found in the LICENSE file.
5 #ifndef SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_
6 #define SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_
8 #include "base/files/file_path.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/syncable/directory_backing_store.h"
12 namespace syncer {
13 namespace syncable {
15 // This is the concrete class that provides a useful implementation of
16 // DirectoryBackingStore.
17 class SYNC_EXPORT_PRIVATE OnDiskDirectoryBackingStore
18 : public DirectoryBackingStore {
19 public:
20 OnDiskDirectoryBackingStore(const std::string& dir_name,
21 const base::FilePath& backing_file_path);
22 ~OnDiskDirectoryBackingStore() override;
23 DirOpenResult Load(Directory::MetahandlesMap* handles_map,
24 JournalIndex* delete_journals,
25 MetahandleSet* metahandles_to_purge,
26 Directory::KernelLoadInfo* kernel_load_info) override;
28 protected:
29 // Subclasses may override this to avoid a possible DCHECK.
30 virtual void ReportFirstTryOpenFailure();
32 // Returns the file path of the back store.
33 const base::FilePath& backing_file_path() const;
35 private:
36 // A helper function that will make one attempt to load the directory.
37 // Unlike Load(), it does not attempt to recover from failure.
38 DirOpenResult TryLoad(Directory::MetahandlesMap* handles_map,
39 JournalIndex* delete_journals,
40 MetahandleSet* metahandles_to_purge,
41 Directory::KernelLoadInfo* kernel_load_info);
43 // The path to the sync DB.
44 const base::FilePath backing_file_path_;
46 DISALLOW_COPY_AND_ASSIGN(OnDiskDirectoryBackingStore);
49 } // namespace syncable
50 } // namespace syncer
52 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_