Diff
Modified: trunk/Source/WebCore/ChangeLog (109323 => 109324)
--- trunk/Source/WebCore/ChangeLog 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/ChangeLog 2012-03-01 09:18:28 UTC (rev 109324)
@@ -1,3 +1,25 @@
+2012-02-29 Kinuko Yasuda <[email protected]>
+
+ Use the new createSnapshotFileAndReadMetadata API for FileEntry.file()
+ https://bugs.webkit.org/show_bug.cgi?id=79928
+
+ Reviewed by David Levin.
+
+ No new tests: no functionality changes.
+ fast/filesystem/ tests should use the new code (they should pass once
+ the corresponding chromium change is rolled in).
+
+ * fileapi/DOMFileSystem.cpp:
+ (WebCore::DOMFileSystem::createFile): Updated to use the new API.
+ * fileapi/DOMFileSystemSync.cpp:
+ (WebCore::DOMFileSystemSync::createFile): Updated to use the new API.
+ * fileapi/FileSystemCallbacks.cpp:
+ * fileapi/FileSystemCallbacks.h:
+ (FileSystemCallbacksBase):
+ * platform/AsyncFileSystem.h:
+ (AsyncFileSystem):
+ * platform/AsyncFileSystemCallbacks.h: Added default implementation (which just calls ASSERT_NOTREACHED()) so that subclasses can focus only on the callback methods that they're interested in.
+
2012-02-29 Pavel Podivilov <[email protected]>
Web Inspector: add UISourceCode.isEditable property.
Modified: trunk/Source/WebCore/fileapi/DOMFileSystem.cpp (109323 => 109324)
--- trunk/Source/WebCore/fileapi/DOMFileSystem.cpp 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/fileapi/DOMFileSystem.cpp 2012-03-01 09:18:28 UTC (rev 109324)
@@ -154,7 +154,7 @@
void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- m_asyncFileSystem->readMetadata(fileEntry->fullPath(), GetPathCallback::create(this, fileEntry->name(), successCallback, errorCallback));
+ m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileEntry->fullPath(), GetPathCallback::create(this, fileEntry->name(), successCallback, errorCallback));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/fileapi/DOMFileSystemSync.cpp (109323 => 109324)
--- trunk/Source/WebCore/fileapi/DOMFileSystemSync.cpp 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/fileapi/DOMFileSystemSync.cpp 2012-03-01 09:18:28 UTC (rev 109324)
@@ -72,83 +72,60 @@
namespace {
-class GetPathHelper : public AsyncFileSystemCallbacks {
+class CreateFileHelper : public AsyncFileSystemCallbacks {
public:
- class GetPathResult : public RefCounted<GetPathResult> {
+ class CreateFileResult : public RefCounted<CreateFileResult> {
public:
- static PassRefPtr<GetPathResult> create()
+ static PassRefPtr<CreateFileResult> create()
{
- return adoptRef(new GetPathResult());
+ return adoptRef(new CreateFileResult());
}
bool m_failed;
int m_code;
- String m_path;
+ RefPtr<File> m_file;
private:
- GetPathResult()
+ CreateFileResult()
: m_failed(false)
, m_code(0)
{
}
- ~GetPathResult()
+ ~CreateFileResult()
{
}
- friend class WTF::RefCounted<GetPathResult>;
+ friend class WTF::RefCounted<CreateFileResult>;
};
- static PassOwnPtr<GetPathHelper> create(PassRefPtr<GetPathResult> result)
+ static PassOwnPtr<CreateFileHelper> create(PassRefPtr<CreateFileResult> result, const String& name)
{
- return adoptPtr(new GetPathHelper(result));
+ return adoptPtr(new CreateFileHelper(result, name));
}
- virtual void didSucceed()
- {
- ASSERT_NOT_REACHED();
- }
-
- virtual void didOpenFileSystem(const String&, PassOwnPtr<AsyncFileSystem>)
- {
- ASSERT_NOT_REACHED();
- }
-
- virtual void didReadDirectoryEntry(const String&, bool)
- {
- ASSERT_NOT_REACHED();
- }
-
- virtual void didReadDirectoryEntries(bool)
- {
- ASSERT_NOT_REACHED();
- }
-
- virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long)
- {
- ASSERT_NOT_REACHED();
- }
-
virtual void didFail(int code)
{
m_result->m_failed = true;
m_result->m_code = code;
}
- virtual ~GetPathHelper()
+ virtual ~CreateFileHelper()
{
}
void didReadMetadata(const FileMetadata& metadata)
{
- m_result->m_path = metadata.platformPath;
+ m_result->m_file = File::createWithName(metadata.platformPath, m_name);
}
private:
- GetPathHelper(PassRefPtr<GetPathResult> result)
+ CreateFileHelper(PassRefPtr<CreateFileResult> result, const String& name)
: m_result(result)
+ , m_name(name)
{
}
- RefPtr<GetPathResult> m_result;
+ RefPtr<CreateFileResult> m_result;
+ String m_name;
};
} // namespace
@@ -156,8 +133,8 @@
PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, ExceptionCode& ec)
{
ec = 0;
- RefPtr<GetPathHelper::GetPathResult> result(GetPathHelper::GetPathResult::create());
- m_asyncFileSystem->readMetadata(fileEntry->fullPath(), GetPathHelper::create(result));
+ RefPtr<CreateFileHelper::CreateFileResult> result(CreateFileHelper::CreateFileResult::create());
+ m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileEntry->fullPath(), CreateFileHelper::create(result, fileEntry->name()));
if (!m_asyncFileSystem->waitForOperationToComplete()) {
ec = FileException::ABORT_ERR;
return 0;
@@ -166,8 +143,7 @@
ec = result->m_code;
return 0;
}
- ASSERT(!result->m_path.isEmpty());
- return File::createWithName(result->m_path, fileEntry->name());
+ return result->m_file;
}
namespace {
Modified: trunk/Source/WebCore/fileapi/FileSystemCallbacks.cpp (109323 => 109324)
--- trunk/Source/WebCore/fileapi/FileSystemCallbacks.cpp 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/fileapi/FileSystemCallbacks.cpp 2012-03-01 09:18:28 UTC (rev 109324)
@@ -65,42 +65,6 @@
{
}
-void FileSystemCallbacksBase::didSucceed()
-{
- // Each subclass must implement an appropriate one.
- ASSERT_NOT_REACHED();
-}
-
-void FileSystemCallbacksBase::didOpenFileSystem(const String&, PassOwnPtr<AsyncFileSystem>)
-{
- // Each subclass must implement an appropriate one.
- ASSERT_NOT_REACHED();
-}
-
-void FileSystemCallbacksBase::didReadMetadata(const FileMetadata&)
-{
- // Each subclass must implement an appropriate one.
- ASSERT_NOT_REACHED();
-}
-
-void FileSystemCallbacksBase::didReadDirectoryEntries(bool)
-{
- // Each subclass must implement an appropriate one.
- ASSERT_NOT_REACHED();
-}
-
-void FileSystemCallbacksBase::didReadDirectoryEntry(const String&, bool)
-{
- // Each subclass must implement an appropriate one.
- ASSERT_NOT_REACHED();
-}
-
-void FileSystemCallbacksBase::didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long)
-{
- // Each subclass must implement an appropriate one.
- ASSERT_NOT_REACHED();
-}
-
void FileSystemCallbacksBase::didFail(int code)
{
if (m_errorCallback) {
Modified: trunk/Source/WebCore/fileapi/FileSystemCallbacks.h (109323 => 109324)
--- trunk/Source/WebCore/fileapi/FileSystemCallbacks.h 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/fileapi/FileSystemCallbacks.h 2012-03-01 09:18:28 UTC (rev 109324)
@@ -59,25 +59,11 @@
public:
virtual ~FileSystemCallbacksBase();
- // For EntryCallbacks and VoidCallbacks.
- virtual void didSucceed();
-
- // For FileSystemCallbacks.
- virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>);
-
- // For MetadataCallbacks.
- virtual void didReadMetadata(const FileMetadata&);
-
- // For EntriesCallbacks. didReadDirectoryEntry is called each time the API reads an entry, and didReadDirectoryDone is called when a chunk of entries have been read (i.e. good time to call back to the application). If hasMore is true there can be more chunks.
- virtual void didReadDirectoryEntry(const String& name, bool isDirectory);
- virtual void didReadDirectoryEntries(bool hasMore);
-
- // For createFileWriter.
- virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length);
-
// For ErrorCallback.
virtual void didFail(int code);
+ // Other callback methods are implemented by each subclass.
+
protected:
FileSystemCallbacksBase(PassRefPtr<ErrorCallback> errorCallback);
RefPtr<ErrorCallback> m_errorCallback;
Modified: trunk/Source/WebCore/platform/AsyncFileSystem.h (109323 => 109324)
--- trunk/Source/WebCore/platform/AsyncFileSystem.h 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/platform/AsyncFileSystem.h 2012-03-01 09:18:28 UTC (rev 109324)
@@ -140,6 +140,13 @@
// AsyncFileSystemCallbacks::didFail() is called otherwise.
virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
+ // Creates a snapshot file and read its metadata for a new File object.
+ // In local filesystem cases the backend may simply return the metadata of the file itself (as well as readMetadata does),
+ // while in remote filesystem case the backend may download the file into a temporary snapshot file and return the metadata of the temporary file.
+ // AsyncFileSystemCallbacks::didReadMetadata() is called when the metadata for the snapshot file is successfully returned.
+ // AsyncFileSystemCallbacks::didFail() is called otherwise.
+ virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
+
Type type() const { return m_type; }
protected:
Modified: trunk/Source/WebCore/platform/AsyncFileSystemCallbacks.h (109323 => 109324)
--- trunk/Source/WebCore/platform/AsyncFileSystemCallbacks.h 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebCore/platform/AsyncFileSystemCallbacks.h 2012-03-01 09:18:28 UTC (rev 109324)
@@ -33,36 +33,35 @@
#if ENABLE(FILE_SYSTEM)
+#include "AsyncFileSystem.h"
+#include "AsyncFileWriter.h"
+#include "FileMetadata.h"
#include "PlatformString.h"
namespace WebCore {
-class AsyncFileSystem;
-class AsyncFileWriter;
-struct FileMetadata;
-
class AsyncFileSystemCallbacks {
WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks);
public:
- AsyncFileSystemCallbacks() { }
+ AsyncFileSystemCallbacks() { }
// Called when a requested operation is completed successfully.
- virtual void didSucceed() = 0;
+ virtual void didSucceed() { ASSERT_NOT_REACHED(); }
// Called when a requested file system is opened.
- virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>) = 0;
+ virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>) { ASSERT_NOT_REACHED(); }
// Called when a file metadata is read successfully.
- virtual void didReadMetadata(const FileMetadata&) = 0;
+ virtual void didReadMetadata(const FileMetadata&) { ASSERT_NOT_REACHED(); }
// Called when a directory entry is read.
- virtual void didReadDirectoryEntry(const String& name, bool isDirectory) = 0;
+ virtual void didReadDirectoryEntry(const String& name, bool isDirectory) { ASSERT_NOT_REACHED(); }
- // Called after a chunk of directory entries have been read (i.e. indicates it's good time to call back to the application). If hasMore is true there can be more chunks.
- virtual void didReadDirectoryEntries(bool hasMore) = 0;
+ // Called after a chunk of directory entries have been read (i.e. indicates it's good time to call back to the application). If hasMore is true there can be more chunks.
+ virtual void didReadDirectoryEntries(bool hasMore) { ASSERT_NOT_REACHED(); }
// Called when an AsyncFileWrter has been created successfully.
- virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter> writer, long long length) = 0;
+ virtual void didCreateFileWriter(PassOwnPtr<AsyncFileWriter>, long long length) { ASSERT_NOT_REACHED(); }
// Called when there was an error.
virtual void didFail(int code) = 0;
Modified: trunk/Source/WebKit/chromium/ChangeLog (109323 => 109324)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-01 09:18:28 UTC (rev 109324)
@@ -1,5 +1,36 @@
2012-02-29 Kinuko Yasuda <[email protected]>
+ Use the new createSnapshotFileAndReadMetadata API for FileEntry.file()
+ https://bugs.webkit.org/show_bug.cgi?id=79928
+
+ Reviewed by David Levin.
+
+ In the new flow we first create an internal Blob URL for the
+ snapshot file and call the new createSnapshotFileAndReadMetadata()
+ WebKit API with the Blob URL.
+
+ The implementor of createSnapshotFileAndReadMetadata() (i.e. chromium)
+ registers the created snapshot file with the given internal Blob URL.
+
+ In the callback chain we call File::createWithName() to create a
+ new File using the returned platform path, and then call
+ unregisterBlobURL() to clean up the internal Blob URL.
+
+ * src/AsyncFileSystemChromium.cpp:
+ (WebCore::AsyncFileSystemChromium::createSnapshotFileAndReadMetadata): Added.
+ (WebCore::AsyncFileSystemChromium::createSnapshotFileCallback): Added.
+ * src/AsyncFileSystemChromium.h:
+ * src/WorkerAsyncFileSystemChromium.cpp:
+ (WebCore::WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata): Added.
+ * src/WorkerAsyncFileSystemChromium.h:
+ * src/WorkerFileSystemCallbacksBridge.cpp:
+ (WebKit::WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread): Added.
+ (WebKit::WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread): Added.
+ * src/WorkerFileSystemCallbacksBridge.h:
+ (WorkerFileSystemCallbacksBridge):
+
+2012-02-29 Kinuko Yasuda <[email protected]>
+
Unreviewed. Rolled DEPS.
* DEPS:
Modified: trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp (109323 => 109324)
--- trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp 2012-03-01 09:18:28 UTC (rev 109324)
@@ -34,7 +34,10 @@
#include "AsyncFileSystemCallbacks.h"
#include "AsyncFileWriterChromium.h"
+#include "BlobURL.h"
+#include "FileMetadata.h"
#include "SecurityOrigin.h"
+#include "ThreadableBlobRegistry.h"
#include "WebFileInfo.h"
#include "WebFileSystemCallbacksImpl.h"
#include "WebFileWriter.h"
@@ -46,11 +49,51 @@
namespace WebCore {
+namespace {
+
// 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;
+// Specialized callback class for createSnapshotFileAndReadMetadata.
+class SnapshotFileCallbacks : public AsyncFileSystemCallbacks {
+public:
+ static PassOwnPtr<SnapshotFileCallbacks> create(const KURL& internalBlobURL, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks)
+ {
+ return adoptPtr(new SnapshotFileCallbacks(internalBlobURL, callbacks));
+ }
+
+ virtual void didReadMetadata(const FileMetadata& metadata)
+ {
+ ASSERT(m_callbacks);
+
+ // This will create a new File object using the metadata.
+ m_callbacks->didReadMetadata(metadata);
+
+ // Now that we've registered the snapshot file, we can unregister our internalBlobURL which has played a placeholder for the file during the IPC.
+ ThreadableBlobRegistry::unregisterBlobURL(m_internalBlobURL);
+ }
+
+ virtual void didFail(int error)
+ {
+ ASSERT(m_callbacks);
+ m_callbacks->didFail(error);
+ }
+
+private:
+ SnapshotFileCallbacks(const KURL& internalBlobURL, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks)
+ : m_internalBlobURL(internalBlobURL)
+ , m_callbacks(callbacks)
+ {
+ }
+
+ KURL m_internalBlobURL;
+ OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks;
+};
+
+} // namespace
+
// static
bool AsyncFileSystem::isAvailable()
{
@@ -254,6 +297,15 @@
m_webFileSystem->readMetadata(pathAsURL, new FileWriterHelperCallbacks(client, pathAsURL, m_webFileSystem, callbacks));
}
+void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+ KURL pathAsURL = virtualPathToFileSystemURL(path);
+ KURL internalBlobURL = BlobURL::createInternalURL();
+
+ // This will create a snapshot file and register the file to a blob using the given internalBlobURL.
+ m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, pathAsURL, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks)));
+}
+
KURL AsyncFileSystemChromium::virtualPathToFileSystemURL(const String& virtualPath) const
{
ASSERT(!m_filesystemRootURL.isEmpty());
@@ -263,6 +315,11 @@
return url;
}
+PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) const
+{
+ return SnapshotFileCallbacks::create(internalBlobURL, callbacks);
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h (109323 => 109324)
--- trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h 2012-03-01 09:18:28 UTC (rev 109324)
@@ -66,9 +66,13 @@
virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
+ virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
protected:
AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL);
+
+ PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const;
+
WebKit::WebFileSystem* m_webFileSystem;
// Converts a given absolute virtual path to a full origin-qualified FileSystem URL.
Modified: trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp (109323 => 109324)
--- trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp 2012-03-01 09:18:28 UTC (rev 109324)
@@ -34,6 +34,7 @@
#if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
#include "AsyncFileSystemCallbacks.h"
+#include "BlobURL.h"
#include "FileMetadata.h"
#include "FileSystem.h"
#include "NotImplemented.h"
@@ -208,6 +209,14 @@
createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, pathAsURL, m_webFileSystem, callbacks, m_workerContext))->postReadMetadataToMainThread(m_webFileSystem, pathAsURL, m_modeForCurrentOperation);
}
+void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
+{
+ KURL pathAsURL = virtualPathToFileSystemURL(path);
+ KURL internalBlobURL = BlobURL::createInternalURL();
+
+ createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, pathAsURL, m_modeForCurrentOperation);
+}
+
PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
ASSERT(!m_synchronous || !m_bridgeForCurrentOperation);
Modified: trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h (109323 => 109324)
--- trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h 2012-03-01 09:18:28 UTC (rev 109324)
@@ -74,6 +74,7 @@
virtual void directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
virtual void createWriter(AsyncFileWriterClient* client, const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
+ virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>);
private:
WorkerAsyncFileSystemChromium(ScriptExecutionContext*, AsyncFileSystem::Type, const WebKit::WebURL& rootURL, bool synchronous);
Modified: trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp (109323 => 109324)
--- trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp 2012-03-01 09:18:28 UTC (rev 109324)
@@ -289,6 +289,15 @@
this, mode));
}
+void WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread(WebFileSystem* fileSystem, const KURL& internalBlobURL, const KURL& path, const String& mode)
+{
+ ASSERT(fileSystem);
+ dispatchTaskToMainThread(
+ createCallbackTask(&createSnapshotFileOnMainThread,
+ AllowCrossThreadAccess(fileSystem),
+ internalBlobURL, path, this, mode));
+}
+
void WorkerFileSystemCallbacksBridge::openFileSystemOnMainThread(ScriptExecutionContext*, WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode)
{
if (!commonClient)
@@ -348,6 +357,11 @@
fileSystem->readDirectory(path, MainThreadFileSystemCallbacks::createLeakedPtr(bridge, mode));
}
+void WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem* fileSystem, const KURL& internalBlobURL, const KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode)
+{
+ fileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, MainThreadFileSystemCallbacks::createLeakedPtr(bridge, mode));
+}
+
void WorkerFileSystemCallbacksBridge::didFailOnMainThread(WebFileError error, const String& mode)
{
mayPostTaskToWorker(createCallbackTask(&didFailOnWorkerThread, this, error), mode);
Modified: trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h (109323 => 109324)
--- trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h 2012-03-01 08:22:20 UTC (rev 109323)
+++ trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h 2012-03-01 09:18:28 UTC (rev 109324)
@@ -94,6 +94,7 @@
void postFileExistsToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode);
void postDirectoryExistsToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode);
void postReadDirectoryToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode);
+ void postCreateSnapshotFileToMainThread(WebFileSystem*, const WebCore::KURL& internalBlobURL, const WebCore::KURL& path, const String& mode);
// Callback methods that are called on the main thread.
void didFailOnMainThread(WebFileError, const String& mode);
@@ -117,6 +118,7 @@
static void fileExistsOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
static void directoryExistsOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
static void readDirectoryOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
+ static void createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& internalBlobURL, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
friend class MainThreadFileSystemCallbacks;