Title: [123653] trunk/Source
Revision
123653
Author
[email protected]
Date
2012-07-25 13:44:27 -0700 (Wed, 25 Jul 2012)

Log Message

FileSystem should provide a way to delete filesystem.
https://bugs.webkit.org/show_bug.cgi?id=91861

Patch by Taiju Tsuiki <[email protected]> on 2012-07-25
Reviewed by Adam Barth.

Source/WebCore:

We will add a test when we wire-up the feature to Inspector.

* Modules/filesystem/LocalFileSystem.cpp: Add deleteFileSystem
(WebCore::deleteFileSystem):
(WebCore):
(WebCore::LocalFileSystem::deleteFileSystem):
* Modules/filesystem/LocalFileSystem.h:
(LocalFileSystem):
* platform/AsyncFileSystem.cpp: Add deleteFileSystem
(WebCore):
(WebCore::AsyncFileSystem::deleteFileSystem):
* platform/AsyncFileSystem.h:
(AsyncFileSystem):
* platform/blackberry/AsyncFileSystemBlackBerry.cpp: Add deleteFileSystem
(WebCore::AsyncFileSystem::deleteFileSystem):
(WebCore):
* platform/gtk/AsyncFileSystemGtk.cpp: Add deleteFileSystem
(WebCore::AsyncFileSystem::deleteFileSystem):
(WebCore):

Source/WebKit/chromium:

* public/WebFrameClient.h:
(WebFrameClient):
(WebKit::WebFrameClient::deleteFileSystem):
* src/LocalFileSystemChromium.cpp: Add deleteFileSystem
(WebCore::deleteFileSystemNotAllowed):
(WebCore):
(WebCore::LocalFileSystem::deleteFileSystem):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123652 => 123653)


--- trunk/Source/WebCore/ChangeLog	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/ChangeLog	2012-07-25 20:44:27 UTC (rev 123653)
@@ -1,3 +1,30 @@
+2012-07-25  Taiju Tsuiki  <[email protected]>
+
+        FileSystem should provide a way to delete filesystem.
+        https://bugs.webkit.org/show_bug.cgi?id=91861
+
+        Reviewed by Adam Barth.
+
+        We will add a test when we wire-up the feature to Inspector.
+
+        * Modules/filesystem/LocalFileSystem.cpp: Add deleteFileSystem
+        (WebCore::deleteFileSystem):
+        (WebCore):
+        (WebCore::LocalFileSystem::deleteFileSystem):
+        * Modules/filesystem/LocalFileSystem.h:
+        (LocalFileSystem):
+        * platform/AsyncFileSystem.cpp: Add deleteFileSystem
+        (WebCore):
+        (WebCore::AsyncFileSystem::deleteFileSystem):
+        * platform/AsyncFileSystem.h:
+        (AsyncFileSystem):
+        * platform/blackberry/AsyncFileSystemBlackBerry.cpp: Add deleteFileSystem
+        (WebCore::AsyncFileSystem::deleteFileSystem):
+        (WebCore):
+        * platform/gtk/AsyncFileSystemGtk.cpp: Add deleteFileSystem
+        (WebCore::AsyncFileSystem::deleteFileSystem):
+        (WebCore):
+
 2012-07-25  Andrey Adaikin  <[email protected]>
 
         Web Inspector: Add more jsdocs to InjectedScriptSource.js

Modified: trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp (123652 => 123653)


--- trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp	2012-07-25 20:44:27 UTC (rev 123653)
@@ -77,11 +77,17 @@
     return m_basePath;
 }
 
+// FIXME: Add FileSystemType parameter.
 static void openFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, bool create, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
 {
     AsyncFileSystem::openFileSystem(basePath, identifier, create, callbacks);
 }
 
+static void deleteFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    AsyncFileSystem::deleteFileSystem(basePath, identifier, type, callbacks);
+}
+
 void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType)
 {
     // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously.
@@ -90,10 +96,17 @@
 
 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType, long long, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType)
 {
+    // FIXME: Pass FileSystemType parameter.
     // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously.
     context->postTask(createCallbackTask(&openFileSystem, fileSystemBasePath(), context->securityOrigin()->databaseIdentifier(), true, callbacks));
 }
 
+void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSystemType type, PassRefPtr<ErrorCallback> callbacks)
+{
+    // AsyncFileSystem::deleteFileSystem calls callbacks synchronously, so the method needs to be called asynchronously.
+    context->postTask(createCallbackTask(&deleteFileSystem, filesystemBasePath(), context->securityOrigin()->databaseIdentifier(), type, callbacks);
+}
+
 } // namespace
 
 #endif // ENABLE(FILE_SYSTEM)

Modified: trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.h (123652 => 123653)


--- trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.h	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.h	2012-07-25 20:44:27 UTC (rev 123653)
@@ -59,6 +59,8 @@
 
     void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, FileSystemSynchronousType = AsynchronousFileSystem);
 
+    void deleteFileSystem(ScriptExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>);
+
 #if !PLATFORM(CHROMIUM)
     // This call is not thread-safe; must be called before any worker threads are created.
     static void initializeLocalFileSystem(const String&);

Modified: trunk/Source/WebCore/platform/AsyncFileSystem.cpp (123652 => 123653)


--- trunk/Source/WebCore/platform/AsyncFileSystem.cpp	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/platform/AsyncFileSystem.cpp	2012-07-25 20:44:27 UTC (rev 123653)
@@ -46,11 +46,18 @@
     return false;
 }
 
+// FIXME: Add FileSystemType parameter.
 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
 {
     notImplemented();
     callbacks->didFail(NOT_SUPPORTED_ERR);
 }
+
+void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    notImplemented();
+    callbacks->didFail(NOT_SUPPORTED_ERR);
+}
 #endif
 
 } // namespace

Modified: trunk/Source/WebCore/platform/AsyncFileSystem.h (123652 => 123653)


--- trunk/Source/WebCore/platform/AsyncFileSystem.h	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/platform/AsyncFileSystem.h	2012-07-25 20:44:27 UTC (rev 123653)
@@ -64,8 +64,12 @@
     static PassOwnPtr<AsyncFileSystem> create();
 
     // Opens a new file system. The create parameter specifies whether or not to create the path if it does not already exists.
+    // FIXME: Add FileSystemType parameter.
     static void openFileSystem(const String& basePath, const String& storageIdentifier, bool create, PassOwnPtr<AsyncFileSystemCallbacks>);
 
+    // Deletes the file system.
+    static void deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>);
+
     // Moves a file or directory from srcPath to destPath.
     // AsyncFileSystemCallbacks::didSucceed() is called when the operation is completed successfully.
     // AsyncFileSystemCallbacks::didFail() is called otherwise.

Modified: trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp (123652 => 123653)


--- trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp	2012-07-25 20:44:27 UTC (rev 123653)
@@ -40,6 +40,7 @@
     return adoptPtr(new AsyncFileSystemBlackBerry());
 }
 
+// FIXME: Add FileSystemType parameter.
 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
 {
     UNUSED_PARAM(basePath);
@@ -50,6 +51,16 @@
     callbacks->didFail(NOT_SUPPORTED_ERR);
 }
 
+void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    UNUSED_PARAM(basePath);
+    UNUSED_PARAM(storageIdentifier);
+    UNUSED_PARAM(type);
+
+    notImplemented();
+    callbacks->didFail(NOT_SUPPORTED_ERR);
+}
+
 AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry()
 {
     notImplemented();

Modified: trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp (123652 => 123653)


--- trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp	2012-07-25 20:44:27 UTC (rev 123653)
@@ -40,12 +40,19 @@
     return adoptPtr(new AsyncFileSystemGtk());
 }
 
+// FIXME: Add FileSystemType parameter.
 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
 {
     notImplemented();
     callbacks->didFail(NOT_SUPPORTED_ERR);
 }
 
+void AsyncFileSystem::deleteFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    notImplemented();
+    callbacks->didFail(NOT_SUPPORTED_ERR);
+}
+
 AsyncFileSystemGtk::AsyncFileSystemGtk()
 {
     notImplemented();

Modified: trunk/Source/WebKit/chromium/ChangeLog (123652 => 123653)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-25 20:44:27 UTC (rev 123653)
@@ -1,3 +1,18 @@
+2012-07-25  Taiju Tsuiki  <[email protected]>
+
+        FileSystem should provide a way to delete filesystem.
+        https://bugs.webkit.org/show_bug.cgi?id=91861
+
+        Reviewed by Adam Barth.
+
+        * public/WebFrameClient.h:
+        (WebFrameClient):
+        (WebKit::WebFrameClient::deleteFileSystem):
+        * src/LocalFileSystemChromium.cpp: Add deleteFileSystem
+        (WebCore::deleteFileSystemNotAllowed):
+        (WebCore):
+        (WebCore::LocalFileSystem::deleteFileSystem):
+
 2012-07-25  Alok Priyadarshi  <[email protected]>
 
         [chromium] WebViewBenchmarkSupport::paint API does not work with recording canvas

Modified: trunk/Source/WebKit/chromium/public/WebFrameClient.h (123652 => 123653)


--- trunk/Source/WebKit/chromium/public/WebFrameClient.h	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebKit/chromium/public/WebFrameClient.h	2012-07-25 20:44:27 UTC (rev 123653)
@@ -346,6 +346,15 @@
         WebFrame*, WebFileSystem::Type, long long size,
         bool create, WebFileSystemCallbacks*) { }
 
+    // Deletes FileSystem.
+    // WebFileSystemCallbacks::didSucceed() must be called when the operation
+    // is completed successfully. WebFileSystemCallbacks::didFail() must be
+    // called otherwise.
+    // All in-flight operations and following operations may fail after the
+    // FileSystem is deleted.
+    virtual void deleteFileSystem(
+        WebFrame*, WebFileSystem::Type, WebFileSystemCallbacks*) { }
+
     // Quota ---------------------------------------------------------
 
     // Queries the origin's storage usage and quota information.

Modified: trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp (123652 => 123653)


--- trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp	2012-07-25 20:34:28 UTC (rev 123652)
+++ trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp	2012-07-25 20:44:27 UTC (rev 123653)
@@ -183,6 +183,11 @@
     callbacks->didFail(WebKit::WebFileErrorAbort);
 }
 
+static void deleteFileSystemNotAllowed(ScriptExecutionContext*, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    callbacks->didFail(WebKit::WebFileErrorAbort);
+}
+
 static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType, long long size, CreationFlag create)
 {
     bool allowed = true;
@@ -226,6 +231,22 @@
     openFileSystemHelper(context, type, callbacks, synchronousType, size, CreateIfNotPresent);
 }
 
+void LocalFileSystem::deleteFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+    ASSERT(context);
+    ASSERT(context->isDocument());
+
+    Document* document = static_cast<Document*>(context);
+    WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
+    WebKit::WebViewImpl* webView = webFrame->viewImpl();
+    if (webView->permissionClient() && !webView->permissionClient()->allowFileSystem(webFrame)) {
+        context->postTask(createCallbackTask(&deleteFileSystemNotAllowed, callbacks));
+        return;
+    }
+
+    webFrame->client()->deleteFileSystem(webFrame, static_cast<WebFileSystem::Type>(type), new WebFileSystemCallbacksImpl(callbacks));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(FILE_SYSTEM)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to