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

Unified Diff: webkit/browser/fileapi/syncable/sync_file_system_backend.h

Issue 18668003: SyncFS: Introduce SyncFileSystemBackend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lazy initialization Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: webkit/browser/fileapi/syncable/sync_file_system_backend.h
diff --git a/webkit/browser/fileapi/syncable/sync_file_system_backend.h b/webkit/browser/fileapi/syncable/sync_file_system_backend.h
new file mode 100644
index 0000000000000000000000000000000000000000..75df17e1fd8e3584fb55d3caecd86ecc44a9adc0
--- /dev/null
+++ b/webkit/browser/fileapi/syncable/sync_file_system_backend.h
@@ -0,0 +1,85 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNC_FILE_SYSTEM_BACKEND_H_
+#define WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNC_FILE_SYSTEM_BACKEND_H_
+
+#include "webkit/browser/fileapi/sandbox_file_system_backend.h"
+#include "webkit/browser/fileapi/syncable/local_file_change_tracker.h"
+#include "webkit/browser/fileapi/syncable/local_file_sync_context.h"
+
+namespace sync_file_system {
+
+class WEBKIT_STORAGE_BROWSER_EXPORT SyncFileSystemBackend
+ : public fileapi::SandboxFileSystemBackend {
+ public:
+ SyncFileSystemBackend(
+ base::SequencedTaskRunner* file_task_runner,
+ const fileapi::FileSystemOptions& file_system_options);
+ virtual ~SyncFileSystemBackend();
+
+ // FileSystemBackend overrides.
+ virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE;
+ virtual void InitializeFileSystem(
+ const GURL& origin_url,
+ fileapi::FileSystemType type,
+ fileapi::OpenFileSystemMode mode,
+ fileapi::FileSystemContext* context,
+ const InitializeFileSystemCallback& callback) OVERRIDE;
+ virtual fileapi::FileSystemFileUtil* GetFileUtil(
+ fileapi::FileSystemType type,
+ const fileapi::FileSystemContext* context) OVERRIDE;
+ virtual fileapi::AsyncFileUtil* GetAsyncFileUtil(
+ fileapi::FileSystemType type,
+ const fileapi::FileSystemContext* context) OVERRIDE;
+ virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
+ const fileapi::FileSystemURL& url,
+ fileapi::FileSystemContext* context,
+ base::PlatformFileError* error_code) const OVERRIDE;
+
+ // FileSystemQuotaUtil overrides.
+ virtual void GetOriginsForTypeOnFileThread(
+ fileapi::FileSystemType type,
+ std::set<GURL>* origins) OVERRIDE;
+ virtual void AddFileUpdateObserver(
+ fileapi::FileSystemType type,
+ fileapi::FileUpdateObserver* observer,
+ base::SequencedTaskRunner* task_runner) OVERRIDE;
+ virtual void AddFileChangeObserver(
+ fileapi::FileSystemType type,
+ fileapi::FileChangeObserver* observer,
+ base::SequencedTaskRunner* task_runner) OVERRIDE;
+ virtual const fileapi::UpdateObserverList* GetUpdateObservers(
+ fileapi::FileSystemType type) const OVERRIDE;
+ virtual const fileapi::ChangeObserverList* GetChangeObservers(
+ fileapi::FileSystemType type) const OVERRIDE;
+
+ static SyncFileSystemBackend* GetBackend(
+ const fileapi::FileSystemContext* file_system_context);
+
+ LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); }
+ void set_change_tracker(scoped_ptr<LocalFileChangeTracker> tracker);
+
+ LocalFileSyncContext* sync_context() { return sync_context_.get(); }
+ void set_sync_context(sync_file_system::LocalFileSyncContext* sync_context);
+
+ private:
+ friend class CannedSyncableFileSystem;
+
+ // This initialization method is lazily called the first time
+ // FileSystemContext is given.
+ void LazyInitialize(fileapi::SandboxContext* sandbox_context_);
+
+ fileapi::UpdateObserverList syncable_update_observers_;
+ fileapi::ChangeObserverList syncable_change_observers_;
+
+ scoped_ptr<LocalFileChangeTracker> change_tracker_;
+ scoped_refptr<sync_file_system::LocalFileSyncContext> sync_context_;
+
+ DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend);
+};
+
+} // namespace sync_file_system
+
+#endif // WEBKIT_BROWSER_FILEAPI_SYNCABLE_SYNC_FILE_SYSTEM_BACKEND_H_

Powered by Google App Engine
This is Rietveld 408576698