Don't use mContentViewCore after WebView has been destroyed.
[chromium-blink-merge.git] / sync / syncable / deferred_on_disk_directory_backing_store.h
blob388e1f9c06baf01dc6d00675d1777ea042d22504
1 // Copyright 2014 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_DEFERRED_ON_DISK_DIRECTORY_BACKING_STORE_H_
6 #define SYNC_SYNCABLE_DEFERRED_ON_DISK_DIRECTORY_BACKING_STORE_H_
8 #include "base/files/file_path.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/syncable/on_disk_directory_backing_store.h"
12 namespace syncer {
13 namespace syncable {
15 // Store used for backing up user's data before first sync. It creates an
16 // in-memory store first and switch to on-disk store if SaveChanges() is
17 // called, which only happens when SyncBackupManager is shut down and a
18 // syncing backend is to be created. Thus we guarantee that user data is not
19 // persisted until user is actually going to sync.
20 class SYNC_EXPORT_PRIVATE DeferredOnDiskDirectoryBackingStore
21 : public OnDiskDirectoryBackingStore {
22 public:
23 DeferredOnDiskDirectoryBackingStore(const std::string& dir_name,
24 const base::FilePath& backing_file_path);
25 ~DeferredOnDiskDirectoryBackingStore() override;
26 DirOpenResult Load(Directory::MetahandlesMap* handles_map,
27 JournalIndex* delete_journals,
28 MetahandleSet* metahandles_to_purge,
29 Directory::KernelLoadInfo* kernel_load_info) override;
30 bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot) override;
32 private:
33 // Create an on-disk directory backing store. Returns true on success, false
34 // on error.
35 bool CreateOnDisk();
37 // Whether an on-disk directory backing store has been created.
38 bool created_on_disk_;
40 DISALLOW_COPY_AND_ASSIGN(DeferredOnDiskDirectoryBackingStore);
43 } // namespace syncable
44 } // namespace syncer
46 #endif // SYNC_SYNCABLE_DEFERRED_ON_DISK_DIRECTORY_BACKING_STORE_H_