Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API)...
authorkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 09:31:21 +0000 (09:31 +0000)
committerkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 09:31:21 +0000 (09:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76551

Source/WebCore:

Reviewed by David Levin.

Moved the implementation of crackFileSystemURL() and toURL() from
WebCore/fileapi/DOMFileSystemBase into WebCore/platform/AsyncFileSystem
so that each platform can extend/implement their behavior if necessary.

No new tests as it has no functional changes.

* fileapi/DOMFileSystemBase.cpp: Moved crackFileSystemURL() to AsyncFileSystem.
* fileapi/DOMFileSystemBase.h:
(DOMFileSystemBase):
* fileapi/EntryBase.cpp: Moved toURL() to AsyncFileSystem.
(WebCore::EntryBase::toURL):
* page/DOMWindow.cpp: Made corresponding callsite changes.
(WebCore::DOMWindow::webkitRequestFileSystem):
(WebCore::DOMWindow::webkitResolveLocalFileSystemURL):
* page/DOMWindow.h:
* platform/AsyncFileSystem.cpp:
(WebCore::AsyncFileSystem::isValidType): Added.
* platform/AsyncFileSystem.h:
(AsyncFileSystem):
* workers/WorkerContext.cpp: Made corresponding callsite changes.
(WebCore::WorkerContext::webkitRequestFileSystem):
(WebCore::WorkerContext::webkitRequestFileSystemSync):
(WebCore::WorkerContext::webkitResolveLocalFileSystemURL):
(WebCore::WorkerContext::webkitResolveLocalFileSystemSyncURL):
* workers/WorkerContext.h:

Source/WebKit/chromium:

* src/AssertMatchingEnums.cpp: Removed the matching assertion for AsyncFileSystem::External (as now we directly use WebFileSystem::TypeExternal).
* src/AsyncFileSystemChromium.cpp:
(WebCore::AsyncFileSystem::crackFileSystemURL): Added.
(WebCore::AsyncFileSystem::isValidType): Added.
(WebCore::AsyncFileSystemChromium::toURL): Added.
* src/AsyncFileSystemChromium.h:
(AsyncFileSystemChromium):
* src/WorkerAsyncFileSystemChromium.cpp: Made this subclass of AsyncFileSystemChromium (rather than that of AsyncFileSystem)
(WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):
* src/WorkerAsyncFileSystemChromium.h:
(WorkerAsyncFileSystemChromium):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106542 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/fileapi/DOMFileSystemBase.cpp
Source/WebCore/fileapi/DOMFileSystemBase.h
Source/WebCore/fileapi/EntryBase.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/platform/AsyncFileSystem.cpp
Source/WebCore/platform/AsyncFileSystem.h
Source/WebCore/workers/WorkerContext.cpp
Source/WebCore/workers/WorkerContext.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/AssertMatchingEnums.cpp
Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
Source/WebKit/chromium/src/AsyncFileSystemChromium.h
Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h

index fdb20d8..e477961 100644 (file)
@@ -1,3 +1,36 @@
+2012-02-02  Kinuko Yasuda  <kinuko@chromium.org>
+
+        Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API) under chromium directory (re-landing r105395)
+        https://bugs.webkit.org/show_bug.cgi?id=76551
+
+        Reviewed by David Levin.
+
+        Moved the implementation of crackFileSystemURL() and toURL() from
+        WebCore/fileapi/DOMFileSystemBase into WebCore/platform/AsyncFileSystem
+        so that each platform can extend/implement their behavior if necessary.
+
+        No new tests as it has no functional changes.
+
+        * fileapi/DOMFileSystemBase.cpp: Moved crackFileSystemURL() to AsyncFileSystem.
+        * fileapi/DOMFileSystemBase.h:
+        (DOMFileSystemBase):
+        * fileapi/EntryBase.cpp: Moved toURL() to AsyncFileSystem.
+        (WebCore::EntryBase::toURL):
+        * page/DOMWindow.cpp: Made corresponding callsite changes.
+        (WebCore::DOMWindow::webkitRequestFileSystem):
+        (WebCore::DOMWindow::webkitResolveLocalFileSystemURL):
+        * page/DOMWindow.h:
+        * platform/AsyncFileSystem.cpp:
+        (WebCore::AsyncFileSystem::isValidType): Added.
+        * platform/AsyncFileSystem.h:
+        (AsyncFileSystem):
+        * workers/WorkerContext.cpp: Made corresponding callsite changes.
+        (WebCore::WorkerContext::webkitRequestFileSystem):
+        (WebCore::WorkerContext::webkitRequestFileSystemSync):
+        (WebCore::WorkerContext::webkitResolveLocalFileSystemURL):
+        (WebCore::WorkerContext::webkitResolveLocalFileSystemSyncURL):
+        * workers/WorkerContext.h:
+
 2012-02-02  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: pause on uncaugh exceptions state is not properly restored
index ec8ef72..2135f2b 100644 (file)
 
 namespace WebCore {
 
-const char DOMFileSystemBase::kPersistentPathPrefix[] = "persistent";
-const size_t DOMFileSystemBase::kPersistentPathPrefixLength = sizeof(DOMFileSystemBase::kPersistentPathPrefix) - 1;
-const char DOMFileSystemBase::kTemporaryPathPrefix[] = "temporary";
-const size_t DOMFileSystemBase::kTemporaryPathPrefixLength = sizeof(DOMFileSystemBase::kTemporaryPathPrefix) - 1;
-const char DOMFileSystemBase::kExternalPathPrefix[] = "external";
-const size_t DOMFileSystemBase::kExternalPathPrefixLength = sizeof(DOMFileSystemBase::kExternalPathPrefix) - 1;
-
-bool DOMFileSystemBase::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
-{
-    if (!url.protocolIs("filesystem"))
-        return false;
-
-    KURL originURL(ParsedURLString, url.path());
-    String path = decodeURLEscapeSequences(originURL.path());
-    if (path.isEmpty() || path[0] != '/')
-        return false;
-    path = path.substring(1);
-
-    if (path.startsWith(kTemporaryPathPrefix)) {
-        type = AsyncFileSystem::Temporary;
-        path = path.substring(kTemporaryPathPrefixLength);
-    } else if (path.startsWith(kPersistentPathPrefix)) {
-        type = AsyncFileSystem::Persistent;
-        path = path.substring(kPersistentPathPrefixLength);
-    } else if (path.startsWith(kExternalPathPrefix)) {
-        type = AsyncFileSystem::External;
-        path = path.substring(kExternalPathPrefixLength);
-    } else
-        return false;
-
-    if (path.isEmpty() || path[0] != '/')
-        return false;
-
-    filePath.swap(path);
-    return true;
-}
-
 DOMFileSystemBase::DOMFileSystemBase(ScriptExecutionContext* context, const String& name, PassOwnPtr<AsyncFileSystem> asyncFileSystem)
     : m_context(context)
     , m_name(name)
index 8bc0b65..18ae8d7 100644 (file)
@@ -62,14 +62,6 @@ public:
     }
     virtual ~DOMFileSystemBase();
 
-    static const char kPersistentPathPrefix[];
-    static const size_t kPersistentPathPrefixLength;
-    static const char kTemporaryPathPrefix[];
-    static const size_t kTemporaryPathPrefixLength;
-    static const char kExternalPathPrefix[];
-    static const size_t kExternalPathPrefixLength;
-    static bool crackFileSystemURL(const KURL&, AsyncFileSystem::Type&, String& filePath);
-
     const String& name() const { return m_name; }
     AsyncFileSystem* asyncFileSystem() const { return m_asyncFileSystem.get(); }
     SecurityOrigin* securityOrigin() const;
index 53f62e7..0b1254b 100644 (file)
@@ -56,27 +56,7 @@ EntryBase::~EntryBase()
 
 String EntryBase::toURL()
 {
-    String originString = m_fileSystem->securityOrigin()->toString();
-    ASSERT(!originString.isEmpty());
-    if (originString == "null")
-        return String();
-    StringBuilder result;
-    result.append("filesystem:");
-    result.append(originString);
-    result.append("/");
-    switch (m_fileSystem->asyncFileSystem()->type()) {
-    case AsyncFileSystem::Temporary:
-        result.append(DOMFileSystemBase::kTemporaryPathPrefix);
-        break;
-    case AsyncFileSystem::Persistent:
-        result.append(DOMFileSystemBase::kPersistentPathPrefix);
-        break;
-    case AsyncFileSystem::External:
-        result.append(DOMFileSystemBase::kExternalPathPrefix);
-        break;
-    }
-    result.append(encodeWithURLEscapeSequences(m_fullPath));
-    return result.toString();
+    return m_fileSystem->asyncFileSystem()->toURL(m_fileSystem->securityOrigin()->toString(), m_fullPath);
 }
 
 } // namespace WebCore
index f550548..f6fe47b 100644 (file)
 #if ENABLE(FILE_SYSTEM)
 #include "AsyncFileSystem.h"
 #include "DOMFileSystem.h"
-#include "DOMFileSystemBase.h"
 #include "EntryCallback.h"
 #include "ErrorCallback.h"
 #include "FileError.h"
@@ -772,7 +771,7 @@ void DOMWindow::webkitRequestFileSystem(int type, long long size, PassRefPtr<Fil
     }
 
     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
-    if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent && fileSystemType != AsyncFileSystem::External) {
+    if (!AsyncFileSystem::isValidType(fileSystemType)) {
         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
         return;
     }
@@ -798,7 +797,7 @@ void DOMWindow::webkitResolveLocalFileSystemURL(const String& url, PassRefPtr<En
 
     AsyncFileSystem::Type type;
     String filePath;
-    if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(completedURL, type, filePath)) {
+    if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::ENCODING_ERR));
         return;
     }
@@ -806,8 +805,6 @@ void DOMWindow::webkitResolveLocalFileSystemURL(const String& url, PassRefPtr<En
     LocalFileSystem::localFileSystem().readFileSystem(document, type, ResolveURICallbacks::create(successCallback, errorCallback, document, filePath));
 }
 
-COMPILE_ASSERT(static_cast<int>(DOMWindow::EXTERNAL) == static_cast<int>(AsyncFileSystem::External), enum_mismatch);
-
 COMPILE_ASSERT(static_cast<int>(DOMWindow::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch);
 COMPILE_ASSERT(static_cast<int>(DOMWindow::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch);
 
index 0916bff..38e8c5d 100644 (file)
@@ -370,7 +370,6 @@ namespace WebCore {
         enum FileSystemType {
             TEMPORARY,
             PERSISTENT,
-            EXTERNAL,
         };
         void webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>);
         void webkitResolveLocalFileSystemURL(const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
index 404aab6..c3c2412 100644 (file)
 
 namespace WebCore {
 
+const char AsyncFileSystem::persistentPathPrefix[] = "persistent";
+const size_t AsyncFileSystem::persistentPathPrefixLength = sizeof(AsyncFileSystem::persistentPathPrefix) - 1;
+const char AsyncFileSystem::temporaryPathPrefix[] = "temporary";
+const size_t AsyncFileSystem::temporaryPathPrefixLength = sizeof(AsyncFileSystem::temporaryPathPrefix) - 1;
+
 #if !PLATFORM(CHROMIUM)
 bool AsyncFileSystem::isAvailable()
 {
@@ -46,6 +51,11 @@ bool AsyncFileSystem::isAvailable()
     return false;
 }
 
+bool AsyncFileSystem::isValidType(Type type)
+{
+    return type == Temporary || type == Persistent;
+}
+
 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type, const String&)
 {
     notImplemented();
index c2c6845..bbef6a4 100644 (file)
@@ -54,14 +54,26 @@ public:
     enum Type {
         Temporary,
         Persistent,
-        External,
     };
 
+    // Path prefixes that are used in the filesystem URLs (that can be obtained by toURL()).
+    // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL
+    static const char persistentPathPrefix[];
+    static const size_t persistentPathPrefixLength;
+    static const char temporaryPathPrefix[];
+    static const size_t temporaryPathPrefixLength;
+
     virtual void stop() { }
     virtual bool hasPendingActivity() { return false; }
 
     static bool isAvailable();
 
+    static bool isValidType(Type);
+
+    static bool crackFileSystemURL(const KURL&, Type&, String& filePath);
+
+    virtual String toURL(const String& originString, const String& fullPath) = 0;
+
     // Subclass must implement this if it supports synchronous operations.
     // This should return false if there are no pending operations.
     virtual bool waitForOperationToComplete() { return false; }
index 8f24330..fbed36b 100644 (file)
@@ -395,7 +395,7 @@ void WorkerContext::webkitRequestFileSystem(int type, long long size, PassRefPtr
     }
 
     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
-    if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent && fileSystemType != AsyncFileSystem::External) {
+    if (!AsyncFileSystem::isValidType(fileSystemType)) {
         DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
         return;
     }
@@ -412,7 +412,7 @@ PassRefPtr<DOMFileSystemSync> WorkerContext::webkitRequestFileSystemSync(int typ
     }
 
     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
-    if (fileSystemType != AsyncFileSystem::Temporary && fileSystemType != AsyncFileSystem::Persistent && fileSystemType != AsyncFileSystem::External) {
+    if (!AsyncFileSystem::isValidType(fileSystemType)) {
         ec = FileException::INVALID_MODIFICATION_ERR;
         return 0;
     }
@@ -432,7 +432,7 @@ void WorkerContext::webkitResolveLocalFileSystemURL(const String& url, PassRefPt
 
     AsyncFileSystem::Type type;
     String filePath;
-    if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(completedURL, type, filePath)) {
+    if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
         DOMFileSystem::scheduleCallback(this, errorCallback, FileError::create(FileError::ENCODING_ERR));
         return;
     }
@@ -451,7 +451,7 @@ PassRefPtr<EntrySync> WorkerContext::webkitResolveLocalFileSystemSyncURL(const S
 
     AsyncFileSystem::Type type;
     String filePath;
-    if (!completedURL.isValid() || !DOMFileSystemBase::crackFileSystemURL(completedURL, type, filePath)) {
+    if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
         ec = FileException::ENCODING_ERR;
         return 0;
     }
@@ -471,7 +471,6 @@ PassRefPtr<EntrySync> WorkerContext::webkitResolveLocalFileSystemSyncURL(const S
 
 COMPILE_ASSERT(static_cast<int>(WorkerContext::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch);
 COMPILE_ASSERT(static_cast<int>(WorkerContext::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch);
-COMPILE_ASSERT(static_cast<int>(WorkerContext::EXTERNAL) == static_cast<int>(AsyncFileSystem::External), enum_mismatch);
 #endif
 
 WorkerContext::Observer::Observer(WorkerContext* context)
index 5850374..43d2e2e 100644 (file)
@@ -139,7 +139,6 @@ namespace WebCore {
         enum FileSystemType {
             TEMPORARY,
             PERSISTENT,
-            EXTERNAL,
         };
         void webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback>);
         PassRefPtr<DOMFileSystemSync> webkitRequestFileSystemSync(int type, long long size, ExceptionCode&);
index 32e9361..323c429 100644 (file)
@@ -1,3 +1,20 @@
+2012-02-02  Kinuko Yasuda  <kinuko@chromium.org>
+
+        Cleanup: Move chrome-specific filesystem type handling code (for FileSystem API) under chromium directory (re-landing r105395)
+        https://bugs.webkit.org/show_bug.cgi?id=76551
+
+        * src/AssertMatchingEnums.cpp: Removed the matching assertion for AsyncFileSystem::External (as now we directly use WebFileSystem::TypeExternal).
+        * src/AsyncFileSystemChromium.cpp:
+        (WebCore::AsyncFileSystem::crackFileSystemURL): Added.
+        (WebCore::AsyncFileSystem::isValidType): Added.
+        (WebCore::AsyncFileSystemChromium::toURL): Added.
+        * src/AsyncFileSystemChromium.h:
+        (AsyncFileSystemChromium):
+        * src/WorkerAsyncFileSystemChromium.cpp: Made this subclass of AsyncFileSystemChromium (rather than that of AsyncFileSystem)
+        (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):
+        * src/WorkerAsyncFileSystemChromium.h:
+        (WorkerAsyncFileSystemChromium):
+
 2012-02-01  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         Avoid creating NamedNodeMap unnecessarily
index 1f91d51..a451b88 100644 (file)
@@ -433,7 +433,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType);
 #if ENABLE(FILE_SYSTEM)
 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary);
 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent);
-COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeExternal, AsyncFileSystem::External);
 COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown);
 COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile);
 COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeDirectory, FileMetadata::TypeDirectory);
index c55c71b..2871282 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "AsyncFileSystemCallbacks.h"
 #include "AsyncFileWriterChromium.h"
+#include "SecurityOrigin.h"
 #include "WebFileInfo.h"
 #include "WebFileSystemCallbacksImpl.h"
 #include "WebFileWriter.h"
 #include "platform/WebFileSystem.h"
 #include "platform/WebKitPlatformSupport.h"
 #include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
+// ChromeOS-specific filesystem type.
+const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);
+const char externalPathPrefix[] = "external";
+const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1;
+
+// static
 bool AsyncFileSystem::isAvailable()
 {
     return true;
 }
 
+// static
+bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
+{
+    if (!url.protocolIs("filesystem"))
+        return false;
+
+    KURL originURL(ParsedURLString, url.path());
+    String path = decodeURLEscapeSequences(originURL.path());
+    if (path.isEmpty() || path[0] != '/')
+        return false;
+    path = path.substring(1);
+
+    if (path.startsWith(temporaryPathPrefix)) {
+        type = Temporary;
+        path = path.substring(temporaryPathPrefixLength);
+    } else if (path.startsWith(persistentPathPrefix)) {
+        type = Persistent;
+        path = path.substring(persistentPathPrefixLength);
+    } else if (path.startsWith(externalPathPrefix)) {
+        type = externalType;
+        path = path.substring(externalPathPrefixLength);
+    } else
+        return false;
+
+    if (path.isEmpty() || path[0] != '/')
+        return false;
+
+    filePath.swap(path);
+    return true;
+}
+
+// static
+bool AsyncFileSystem::isValidType(Type type)
+{
+    return type == Temporary || type == Persistent || type == static_cast<Type>(WebKit::WebFileSystem::TypeExternal);
+}
+
 AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const KURL& rootURL)
     : AsyncFileSystem(type)
     , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem())
@@ -61,6 +106,28 @@ AsyncFileSystemChromium::~AsyncFileSystemChromium()
 {
 }
 
+String AsyncFileSystemChromium::toURL(const String& originString, const String& fullPath)
+{
+    ASSERT(!originString.isEmpty());
+    if (originString == "null")
+        return String();
+
+    if (type() == externalType) {
+        // For external filesystem originString could be different from what we have in m_filesystemRootURL.
+        StringBuilder result;
+        result.append("filesystem:");
+        result.append(originString);
+        result.append("/");
+        result.append(externalPathPrefix);
+        result.append(encodeWithURLEscapeSequences(fullPath));
+        return result.toString();
+    }
+
+    // For regular types we can just call virtualPathToFileSystemURL which appends the fullPath to the m_filesystemRootURL that should look like 'filesystem:<origin>/<typePrefix>'.
+    ASSERT(SecurityOrigin::create(m_filesystemRootURL)->toString() == originString);
+    return virtualPathToFileSystemURL(fullPath);
+}
+
 void AsyncFileSystemChromium::move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
 {
     m_webFileSystem->move(virtualPathToFileSystemURL(sourcePath), virtualPathToFileSystemURL(destinationPath), new WebKit::WebFileSystemCallbacksImpl(callbacks));
index 0c550b5..a8cbca2 100644 (file)
@@ -54,6 +54,7 @@ public:
 
     virtual ~AsyncFileSystemChromium();
 
+    virtual String toURL(const String& originString, const String& fullPath);
     virtual void move(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>);
     virtual void copy(const String& sourcePath, const String& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>);
     virtual void remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
@@ -66,7 +67,7 @@ public:
     virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
     virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
 
-private:
+protected:
     AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL);
     WebKit::WebFileSystem* m_webFileSystem;
 
index 6155d15..7fbb1f4 100644 (file)
@@ -57,14 +57,11 @@ namespace WebCore {
 static const char fileSystemOperationsMode[] = "fileSystemOperationsMode";
 
 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)
-    : AsyncFileSystem(type)
+    : AsyncFileSystemChromium(type, rootURL)
     , m_scriptExecutionContext(context)
-    , m_webFileSystem(webKitPlatformSupport()->fileSystem())
     , m_workerContext(static_cast<WorkerContext*>(context))
     , m_synchronous(synchronous)
-    , m_filesystemRootURL(rootURL)
 {
-    ASSERT(m_webFileSystem);
     ASSERT(m_scriptExecutionContext->isWorkerContext());
 
     WorkerLoaderProxy* workerLoaderProxy = &m_workerContext->thread()->workerLoaderProxy();
@@ -222,15 +219,6 @@ PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::creat
     return m_bridgeForCurrentOperation;
 }
 
-KURL WorkerAsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const
-{
-    ASSERT(!m_filesystemRootURL.isEmpty());
-    KURL url = m_filesystemRootURL;
-    // Remove the extra leading slash.
-    url.setPath(url.path() + encodeWithURLEscapeSequences(virtualPath.substring(1)));
-    return url;
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(FILE_SYSTEM)
index 13a8e7c..c8ae356 100644 (file)
@@ -33,7 +33,7 @@
 
 #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
 
-#include "AsyncFileSystem.h"
+#include "AsyncFileSystemChromium.h"
 #include "PlatformString.h"
 #include <wtf/PassOwnPtr.h>
 #include <wtf/RefPtr.h>
@@ -51,7 +51,7 @@ class AsyncFileSystemCallbacks;
 class ScriptExecutionContext;
 class WorkerContext;
 
-class WorkerAsyncFileSystemChromium : public AsyncFileSystem {
+class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium {
 public:
     static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)
     {
@@ -80,17 +80,12 @@ private:
 
     PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>);
 
-    // Converts a given absolute virtual path to a full origin-qualified FileSystem URL.
-    KURL virtualPathToFileSystemURL(const String& virtualPath) const;
-
     ScriptExecutionContext* m_scriptExecutionContext;
-    WebKit::WebFileSystem* m_webFileSystem;
     WebKit::WebWorkerBase* m_worker;
     WorkerContext* m_workerContext;
     RefPtr<WebKit::WorkerFileSystemCallbacksBridge> m_bridgeForCurrentOperation;
     String m_modeForCurrentOperation;
     bool m_synchronous;
-    KURL m_filesystemRootURL;
 };
 
 } // namespace WebCore