diff options
author | Kristian Monsen <kristianm@google.com> | 2010-09-30 15:42:16 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-10-07 10:59:29 +0100 |
commit | bec39347bb3bb5bf1187ccaf471d26247f28b585 (patch) | |
tree | 56bdc4c2978fbfd3d79d0d36d5d6c640ecc09cc8 /WebCore/fileapi/LocalFileSystem.h | |
parent | 90b7966e7815b262cd19ac25f03aaad9b21fdc06 (diff) | |
download | external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.zip external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.gz external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.bz2 |
Merge WebKit at r68651 : Initial merge by git.
Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12
Diffstat (limited to 'WebCore/fileapi/LocalFileSystem.h')
-rw-r--r-- | WebCore/fileapi/LocalFileSystem.h | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/WebCore/fileapi/LocalFileSystem.h b/WebCore/fileapi/LocalFileSystem.h index 48cfa8f..bb1d045 100644 --- a/WebCore/fileapi/LocalFileSystem.h +++ b/WebCore/fileapi/LocalFileSystem.h @@ -44,20 +44,44 @@ class ErrorCallback; class FileSystemCallback; class ScriptExecutionContext; -class LocalFileSystem : public RefCounted<LocalFileSystem> { +// Keeps per-process information and provides an entry point to open a file system. +class LocalFileSystem : public Noncopyable { public: - static PassRefPtr<LocalFileSystem> create(const String& basePath); - virtual ~LocalFileSystem() { } + // Returns a per-process instance of LocalFileSystem. + // Note that LocalFileSystem::initializeLocalFileSystem must be called before + // calling this one. + static LocalFileSystem& localFileSystem(); - void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>); + void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassOwnPtr<AsyncFileSystemCallbacks>); -protected: +#if !PLATFORM(CHROMIUM) + // This call is not thread-safe; must be called before any worker threads are created. + void initializeLocalFileSystem(const String&); + + String fileSystemBasePath() const; +#endif + +private: LocalFileSystem(const String& basePath) : m_basePath(basePath) { } - String m_basePath; + static LocalFileSystem* s_instance; + + // An inner class that enforces thread-safe string access. + class SystemBasePath { + public: + explicit SystemBasePath(const String& path) : m_value(path) { } + operator String() const + { + return m_value.threadsafeCopy(); + } + private: + String m_value; + }; + + SystemBasePath m_basePath; }; } // namespace |