Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: sync/syncable/on_disk_directory_backing_store.h

Issue 1008103002: Sync: Avoid 3 passes over SyncDarta DB when loading the directory from the disk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/syncable/mutable_entry.cc ('k') | sync/syncable/on_disk_directory_backing_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "sync/base/sync_export.h" 9 #include "sync/base/sync_export.h"
10 #include "sync/syncable/directory_backing_store.h" 10 #include "sync/syncable/directory_backing_store.h"
11 11
12 namespace syncer { 12 namespace syncer {
13 namespace syncable { 13 namespace syncable {
14 14
15 // This is the concrete class that provides a useful implementation of 15 // This is the concrete class that provides a useful implementation of
16 // DirectoryBackingStore. 16 // DirectoryBackingStore.
17 class SYNC_EXPORT_PRIVATE OnDiskDirectoryBackingStore 17 class SYNC_EXPORT_PRIVATE OnDiskDirectoryBackingStore
18 : public DirectoryBackingStore { 18 : public DirectoryBackingStore {
19 public: 19 public:
20 OnDiskDirectoryBackingStore(const std::string& dir_name, 20 OnDiskDirectoryBackingStore(const std::string& dir_name,
21 const base::FilePath& backing_filepath); 21 const base::FilePath& backing_filepath);
22 ~OnDiskDirectoryBackingStore() override; 22 ~OnDiskDirectoryBackingStore() override;
23 DirOpenResult Load(Directory::MetahandlesMap* handles_map, 23 DirOpenResult Load(Directory::MetahandlesMap* handles_map,
24 JournalIndex* delete_journals, 24 JournalIndex* delete_journals,
25 MetahandleSet* metahandles_to_purge,
25 Directory::KernelLoadInfo* kernel_load_info) override; 26 Directory::KernelLoadInfo* kernel_load_info) override;
26 27
27 // A helper function that will make one attempt to load the directory. 28 // A helper function that will make one attempt to load the directory.
28 // Unlike Load(), it does not attempt to recover from failure. 29 // Unlike Load(), it does not attempt to recover from failure.
29 DirOpenResult TryLoad( 30 DirOpenResult TryLoad(Directory::MetahandlesMap* handles_map,
30 Directory::MetahandlesMap* handles_map, 31 JournalIndex* delete_journals,
31 JournalIndex* delete_journals, 32 MetahandleSet* metahandles_to_purge,
32 Directory::KernelLoadInfo* kernel_load_info); 33 Directory::KernelLoadInfo* kernel_load_info);
33 34
34 protected: 35 protected:
35 // Subclasses may override this to avoid a possible DCHECK. 36 // Subclasses may override this to avoid a possible DCHECK.
36 virtual void ReportFirstTryOpenFailure(); 37 virtual void ReportFirstTryOpenFailure();
37 38
38 private: 39 private:
39 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MinorCorruption); 40 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MinorCorruption);
40 41
41 bool allow_failure_for_test_; 42 bool allow_failure_for_test_;
42 base::FilePath backing_filepath_; 43 base::FilePath backing_filepath_;
43 44
44 DISALLOW_COPY_AND_ASSIGN(OnDiskDirectoryBackingStore); 45 DISALLOW_COPY_AND_ASSIGN(OnDiskDirectoryBackingStore);
45 }; 46 };
46 47
47 } // namespace syncable 48 } // namespace syncable
48 } // namespace syncer 49 } // namespace syncer
49 50
50 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_ 51 #endif // SYNC_SYNCABLE_ON_DISK_DIRECTORY_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « sync/syncable/mutable_entry.cc ('k') | sync/syncable/on_disk_directory_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698