Changeset 145771 in webkit


Ignore:
Timestamp:
Mar 13, 2013 5:01:24 PM (11 years ago)
Author:
Michael Nordman
Message:

Source/WebCore: FileSystem mods: Changes to snapshot file creation to reduce dependencies on blob URLs.
Adding a new minimal BlobDataHandle class which will be reimplemented/built upon in later CLs. In this
patch, it's just enough to refactor the FileSystem code to not function in terms of blobURLs.
https://bugs.webkit.org/show_bug.cgi?id=108851

Reviewed by Adam Barth.

No new tests. This is strictly a refactoring of the existing code.

  • Modules/filesystem/DOMFileSystem.cpp:

(WebCore):
(WebCore::DOMFileSystem::createFile):

  • Modules/filesystem/DOMFileSystemSync.cpp:

(WebCore):

  • platform/AsyncFileSystemCallbacks.h:

(AsyncFileSystemCallbacks):
(WebCore::AsyncFileSystemCallbacks::didCreateSnapshotFile):

  • platform/gtk/AsyncFileSystemGtk.cpp:

(WebCore::AsyncFileSystemGtk::createSnapshotFileAndReadMetadata):
(WebCore):

  • platform/network/BlobData.cpp:

(WebCore):
(WebCore::BlobDataHandle::BlobDataHandle):
(WebCore::BlobDataHandle::~BlobDataHandle):

  • platform/network/BlobData.h:

(WebCore):
(BlobDataHandle):
(WebCore::BlobDataHandle::create):

Source/WebKit/chromium: [Chromium] FileSystem mods: Changes to snapshot file creation to reduce dependencies on blobs.
No longer send a |blobURL| to the browser process, no longer expect the browser process
to have registered a blob with that url.
https://bugs.webkit.org/show_bug.cgi?id=108851

Reviewed by Adam Barth.

  • src/AsyncFileSystemChromium.cpp:

(WebCore):
(WebCore::FileWriterHelperCallbacks::didCreateSnapshotFile):
(WebCore::AsyncFileSystemChromium::createSnapshotFileAndReadMetadata):

  • src/AsyncFileSystemChromium.h:

(AsyncFileSystemChromium):

  • src/LocalFileSystemChromium.cpp:

(WebCore):

  • src/WebFileSystemCallbacksImpl.cpp:

(WebKit::WebFileSystemCallbacksImpl::didCreateSnapshotFile):
(WebKit):

  • src/WebFileSystemCallbacksImpl.h:

(WebCore):
(WebFileSystemCallbacksImpl):

  • src/WorkerAsyncFileSystemChromium.cpp:

(WebCore::WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata):
(WebCore::WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge):

  • src/WorkerFileSystemCallbacksBridge.cpp:

(WebKit::MainThreadFileSystemCallbacks::didCreateSnapshotFile):
(MainThreadFileSystemCallbacks):
(WebKit::WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread):
(WebKit::WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread):
(WebKit::WorkerFileSystemCallbacksBridge::didCreateSnapshotFileOnMainThread):
(WebKit):
(WebKit::WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge):
(WebKit::WorkerFileSystemCallbacksBridge::didCreateSnapshotFileOnWorkerThread):

  • src/WorkerFileSystemCallbacksBridge.h:

(WebCore):
(WebKit):
(WebKit::WorkerFileSystemCallbacksBridge::create):
(WorkerFileSystemCallbacksBridge):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r145768 r145771  
     12013-03-13  Michael Nordman  <michaeln@google.com>
     2
     3        FileSystem mods: Changes to snapshot file creation to reduce dependencies on blob URLs.
     4        Adding a new minimal BlobDataHandle class which will be reimplemented/built upon in later CLs. In this
     5        patch, it's just enough to refactor the FileSystem code to not function in terms of blobURLs.
     6        https://bugs.webkit.org/show_bug.cgi?id=108851
     7
     8        Reviewed by Adam Barth.
     9
     10        No new tests. This is strictly a refactoring of the existing code.
     11
     12        * Modules/filesystem/DOMFileSystem.cpp:
     13        (WebCore):
     14        (WebCore::DOMFileSystem::createFile):
     15        * Modules/filesystem/DOMFileSystemSync.cpp:
     16        (WebCore):
     17        * platform/AsyncFileSystemCallbacks.h:
     18        (AsyncFileSystemCallbacks):
     19        (WebCore::AsyncFileSystemCallbacks::didCreateSnapshotFile):
     20        * platform/gtk/AsyncFileSystemGtk.cpp:
     21        (WebCore::AsyncFileSystemGtk::createSnapshotFileAndReadMetadata):
     22        (WebCore):
     23        * platform/network/BlobData.cpp:
     24        (WebCore):
     25        (WebCore::BlobDataHandle::BlobDataHandle):
     26        (WebCore::BlobDataHandle::~BlobDataHandle):
     27        * platform/network/BlobData.h:
     28        (WebCore):
     29        (BlobDataHandle):
     30        (WebCore::BlobDataHandle::create):
     31
    1322013-03-13  Ryosuke Niwa  <rniwa@webkit.org>
    233
  • trunk/Source/WebCore/Modules/filesystem/DOMFileSystem.cpp

    r125391 r145771  
    149149namespace {
    150150
    151 class GetMetadataCallback : public FileSystemCallbacksBase {
     151class SnapshotFileCallback : public FileSystemCallbacksBase {
    152152public:
    153     static PassOwnPtr<GetMetadataCallback> create(PassRefPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
    154     {
    155         return adoptPtr(new GetMetadataCallback(filesystem, name, url, successCallback, errorCallback));
    156     }
    157 
    158     virtual void didReadMetadata(const FileMetadata& metadata)
     153    static PassOwnPtr<SnapshotFileCallback> create(PassRefPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
     154    {
     155        return adoptPtr(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback));
     156    }
     157
     158    virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<BlobDataHandle> snapshot)
    159159    {
    160160        ASSERT(!metadata.platformPath.isEmpty());
    161161        if (!m_successCallback)
    162162            return;
     163
     164        // We can't directly use the snapshot blob data handle because the content type on it hasn't been set.
     165        // The |snapshot| param is here to provide a a chain of custody thru thread bridging that is held onto until
     166        // *after* we've coined a File with a new handle that has the correct type set on it. This allows the
     167        // blob storage system to track when a temp file can and can't be safely deleted.
    163168
    164169        // For regular filesystem types (temporary or persistent), we should not cache file metadata as it could change File semantics.
     
    180185
    181186private:
    182     GetMetadataCallback(PassRefPtr<DOMFileSystem> filesystem, const String& name,  const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
     187    SnapshotFileCallback(PassRefPtr<DOMFileSystem> filesystem, const String& name,  const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
    183188        : FileSystemCallbacksBase(errorCallback)
    184189        , m_filesystem(filesystem)
     
    200205{
    201206    KURL fileSystemURL = createFileSystemURL(fileEntry);
    202     m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileSystemURL, GetMetadataCallback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCallback));
     207    m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileCallback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCallback));
    203208}
    204209
  • trunk/Source/WebCore/Modules/filesystem/DOMFileSystemSync.cpp

    r125391 r145771  
    114114    }
    115115
    116     void didReadMetadata(const FileMetadata& metadata)
    117     {
     116    virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<BlobDataHandle> snapshot)
     117    {
     118        // We can't directly use the snapshot blob data handle because the content type on it hasn't been set.
     119        // The |snapshot| param is here to provide a a chain of custody thru thread bridging that is held onto until
     120        // *after* we've coined a File with a new handle that has the correct type set on it. This allows the
     121        // blob storage system to track when a temp file can and can't be safely deleted.
     122
    118123        // For regular filesystem types (temporary or persistent), we should not cache file metadata as it could change File semantics.
    119         // For other filesystem types (which could be platform-specific ones), there's a chance that the files are on remote filesystem. If the port has returned metadata just pass it to File constructor (so we may cache the metadata).
     124        // For other filesystem types (which could be platform-specific ones), there's a chance that the files are on remote filesystem.
     125        // If the port has returned metadata just pass it to File constructor (so we may cache the metadata).
    120126        // FIXME: We should use the snapshot metadata for all files.
    121127        // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746
  • trunk/Source/WebCore/platform/AsyncFileSystemCallbacks.h

    r127757 r145771  
    3636#include "AsyncFileSystem.h"
    3737#include "AsyncFileWriter.h"
     38#include "BlobData.h"
    3839#include "FileMetadata.h"
    3940#include <wtf/text/WTFString.h>
     
    5455    // Called when a file metadata is read successfully.
    5556    virtual void didReadMetadata(const FileMetadata&) { ASSERT_NOT_REACHED(); }
     57
     58    // Called when a snapshot file is created successfully.
     59    virtual void didCreateSnapshotFile(const FileMetadata&, PassRefPtr<BlobDataHandle> snapshot) { ASSERT_NOT_REACHED(); }
    5660
    5761    // Called when a directory entry is read.
  • trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp

    r129988 r145771  
    119119}
    120120
     121void AsyncFileSystemGtk::createSnapshotFileAndReadMetadata(const KURL&, PassOwnPtr<AsyncFileSystemCallbacks>)
     122{
     123    notImplemented();
     124}
     125
    121126} // namespace WebCore
    122127
  • trunk/Source/WebCore/platform/network/BlobData.cpp

    r125391 r145771  
    3131#include "config.h"
    3232#include "BlobData.h"
     33#include "BlobURL.h"
     34#include "ThreadableBlobRegistry.h"
    3335
    3436#include <wtf/OwnPtr.h>
     
    102104}
    103105
     106
     107BlobDataHandle::BlobDataHandle(PassOwnPtr<BlobData> data, long long size)
     108{
     109    UNUSED_PARAM(size);
     110    m_internalURL = BlobURL::createInternalURL();
     111    ThreadableBlobRegistry::registerBlobURL(m_internalURL, data);
     112}
     113
     114BlobDataHandle::~BlobDataHandle()
     115{
     116    ThreadableBlobRegistry::unregisterBlobURL(m_internalURL);
     117}
     118
    104119} // namespace WebCore
  • trunk/Source/WebCore/platform/network/BlobData.h

    r144372 r145771  
    203203};
    204204
     205// FIXME: This class is mostly place holder until I get farther along with
     206// https://bugs.webkit.org/show_bug.cgi?id=108733 and more specifically with landing
     207// https://codereview.chromium.org/11192017/.
     208class BlobDataHandle : public ThreadSafeRefCounted<BlobDataHandle> {
     209public:
     210    static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long long size)
     211    {
     212        return adoptRef(new BlobDataHandle(data, size));
     213    }
     214
     215    ~BlobDataHandle();
     216
     217private:
     218    BlobDataHandle(PassOwnPtr<BlobData>, long long size);
     219    KURL m_internalURL;
     220};
     221
    205222} // namespace WebCore
    206223
  • trunk/Source/WebKit/chromium/ChangeLog

    r145770 r145771  
     12013-03-13  Michael Nordman  <michaeln@google.com>
     2
     3        [Chromium] FileSystem mods: Changes to snapshot file creation to reduce dependencies on blobs.
     4        No longer send a |blobURL| to the browser process, no longer expect the browser process
     5        to have registered a blob with that url.
     6        https://bugs.webkit.org/show_bug.cgi?id=108851
     7
     8        Reviewed by Adam Barth.
     9
     10        * src/AsyncFileSystemChromium.cpp:
     11        (WebCore):
     12        (WebCore::FileWriterHelperCallbacks::didCreateSnapshotFile):
     13        (WebCore::AsyncFileSystemChromium::createSnapshotFileAndReadMetadata):
     14        * src/AsyncFileSystemChromium.h:
     15        (AsyncFileSystemChromium):
     16        * src/LocalFileSystemChromium.cpp:
     17        (WebCore):
     18        * src/WebFileSystemCallbacksImpl.cpp:
     19        (WebKit::WebFileSystemCallbacksImpl::didCreateSnapshotFile):
     20        (WebKit):
     21        * src/WebFileSystemCallbacksImpl.h:
     22        (WebCore):
     23        (WebFileSystemCallbacksImpl):
     24        * src/WorkerAsyncFileSystemChromium.cpp:
     25        (WebCore::WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata):
     26        (WebCore::WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge):
     27        * src/WorkerFileSystemCallbacksBridge.cpp:
     28        (WebKit::MainThreadFileSystemCallbacks::didCreateSnapshotFile):
     29        (MainThreadFileSystemCallbacks):
     30        (WebKit::WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread):
     31        (WebKit::WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread):
     32        (WebKit::WorkerFileSystemCallbacksBridge::didCreateSnapshotFileOnMainThread):
     33        (WebKit):
     34        (WebKit::WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge):
     35        (WebKit::WorkerFileSystemCallbacksBridge::didCreateSnapshotFileOnWorkerThread):
     36        * src/WorkerFileSystemCallbacksBridge.h:
     37        (WebCore):
     38        (WebKit):
     39        (WebKit::WorkerFileSystemCallbacksBridge::create):
     40        (WorkerFileSystemCallbacksBridge):
     41
    1422013-03-13  Adam Barth  <abarth@webkit.org>
    243
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp

    r138798 r145771  
    4848
    4949namespace WebCore {
    50 
    51 namespace {
    52 
    53 // Specialized callback class for createSnapshotFileAndReadMetadata.
    54 class SnapshotFileCallbacks : public AsyncFileSystemCallbacks {
    55 public:
    56     static PassOwnPtr<SnapshotFileCallbacks> create(const KURL& internalBlobURL, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks)
    57     {
    58         return adoptPtr(new SnapshotFileCallbacks(internalBlobURL, callbacks));
    59     }
    60 
    61     virtual void didReadMetadata(const FileMetadata& metadata)
    62     {
    63         ASSERT(m_callbacks);
    64 
    65         // This will create a new File object using the metadata.
    66         m_callbacks->didReadMetadata(metadata);
    67 
    68         // Now that we've registered the snapshot file, we can unregister our internalBlobURL which has played a placeholder for the file during the IPC.
    69         ThreadableBlobRegistry::unregisterBlobURL(m_internalBlobURL);
    70     }
    71 
    72     virtual void didFail(int error)
    73     {
    74         ASSERT(m_callbacks);
    75         m_callbacks->didFail(error);
    76     }
    77 
    78 private:
    79     SnapshotFileCallbacks(const KURL& internalBlobURL, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks)
    80         : m_internalBlobURL(internalBlobURL)
    81         , m_callbacks(callbacks)
    82     {
    83     }
    84 
    85     KURL m_internalBlobURL;
    86     OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks;
    87 };
    88 
    89 } // namespace
    9050
    9151bool AsyncFileSystem::isAvailable()
     
    187147        delete this;
    188148    }
    189 
     149    virtual void didCreateSnapshotFile(const WebKit::WebFileInfo& info)
     150    {
     151        ASSERT_NOT_REACHED();
     152        delete this;
     153    }
    190154    virtual void didReadDirectory(const WebKit::WebVector<WebKit::WebFileSystemEntry>& entries, bool hasMore)
    191155    {
     
    220184void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    221185{
    222     KURL internalBlobURL = BlobURL::createInternalURL();
    223 
    224     // This will create a snapshot file and register the file to a blob using the given internalBlobURL.
    225     m_webFileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, new WebKit::WebFileSystemCallbacksImpl(createSnapshotFileCallback(internalBlobURL, callbacks)));
    226 }
    227 
    228 PassOwnPtr<AsyncFileSystemCallbacks> AsyncFileSystemChromium::createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) const
    229 {
    230     return SnapshotFileCallbacks::create(internalBlobURL, callbacks);
     186    m_webFileSystem->createSnapshotFileAndReadMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
    231187}
    232188
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h

    r116388 r145771  
    7070    AsyncFileSystemChromium();
    7171
    72     PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const;
    73 
    7472    WebKit::WebFileSystem* m_webFileSystem;
    7573};
  • trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp

    r145452 r145771  
    154154}
    155155
    156 void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, FileSystemSynchronousType synchronousType)
     156void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacksImpl* callbacks, FileSystemSynchronousType synchronousType)
    157157{
    158158    WorkerScriptController* controller = WorkerScriptController::controllerForContext();
  • trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp

    r145452 r145771  
    7777}
    7878
     79void WebFileSystemCallbacksImpl::didCreateSnapshotFile(const WebFileInfo& webFileInfo)
     80{
     81    // It's important to create a BlobDataHandle that refers to the platform file path prior
     82    // to return from this method so the underlying file will not be deleted.
     83    OwnPtr<BlobData> blobData = BlobData::create();
     84    blobData->appendFile(webFileInfo.platformPath);
     85    RefPtr<BlobDataHandle> snapshotBlob = BlobDataHandle::create(blobData.release(), webFileInfo.length);
     86    didCreateSnapshotFile(webFileInfo, snapshotBlob);
     87}
     88
     89void WebFileSystemCallbacksImpl::didCreateSnapshotFile(const WebFileInfo& webFileInfo, PassRefPtr<WebCore::BlobDataHandle> snapshot)
     90{
     91    FileMetadata fileMetadata;
     92    fileMetadata.modificationTime = webFileInfo.modificationTime;
     93    fileMetadata.length = webFileInfo.length;
     94    fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type);
     95    fileMetadata.platformPath = webFileInfo.platformPath;
     96    m_callbacks->didCreateSnapshotFile(fileMetadata, snapshot);
     97    delete this;
     98}
     99
    79100void WebFileSystemCallbacksImpl::didReadDirectory(const WebVector<WebFileSystemEntry>& entries, bool hasMore)
    80101{
  • trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h

    r145452 r145771  
    4141namespace WebCore {
    4242class AsyncFileSystemCallbacks;
     43class BlobDataHandle;
    4344class ScriptExecutionContext;
    4445}
     
    5758
    5859    virtual void didSucceed();
    59     virtual void didReadMetadata(const WebFileInfo& info);
     60    virtual void didReadMetadata(const WebFileInfo&);
     61    virtual void didCreateSnapshotFile(const WebFileInfo&);
    6062    virtual void didReadDirectory(const WebVector<WebFileSystemEntry>& entries, bool hasMore);
    6163    virtual void didOpenFileSystem(const WebString& name, const WebURL& rootURL);
    6264    virtual void didFail(WebFileError error);
     65
     66    // This internal overload is used by WorkerFileSystemCallbacksBridge to deliver a blob data handle
     67    // created on the main thread to an AsyncFileSystemCallback on a background worker thread. The other
     68    // virtual method is invoked by the embedder.
     69    void didCreateSnapshotFile(const WebFileInfo&, PassRefPtr<WebCore::BlobDataHandle> snapshot);
    6370
    6471private:
  • trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp

    r138693 r145771  
    180180void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    181181{
    182     KURL internalBlobURL = BlobURL::createInternalURL();
    183 
    184     createWorkerFileSystemCallbacksBridge(createSnapshotFileCallback(internalBlobURL, callbacks))->postCreateSnapshotFileToMainThread(m_webFileSystem, internalBlobURL, path, m_modeForCurrentOperation);
     182    createWorkerFileSystemCallbacksBridge(callbacks)->postCreateSnapshotFileToMainThread(m_webFileSystem, path, m_modeForCurrentOperation);
    185183}
    186184
     
    188186{
    189187    ASSERT(m_synchronousType == AsynchronousFileSystem || !m_bridgeForCurrentOperation);
    190     (void)m_synchronousType;
    191188
    192189    m_modeForCurrentOperation = fileSystemOperationsMode;
  • trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp

    r145452 r145771  
    3434#if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
    3535
     36#include "BlobData.h"
    3637#include "CrossThreadTask.h"
    3738#include "KURL.h"
    3839#include "WebCommonWorkerClient.h"
     40#include "WebFileSystemCallbacksImpl.h"
    3941#include "WebWorkerBase.h"
    4042#include "WorkerContext.h"
     
    4345#include "WorkerThread.h"
    4446#include <public/WebFileInfo.h>
    45 #include <public/WebFileSystemCallbacks.h>
    4647#include <public/WebFileSystemEntry.h>
    4748#include <public/WebString.h>
     
    125126    }
    126127
     128    virtual void didCreateSnapshotFile(const WebFileInfo& info)
     129    {
     130        // It's important to create a BlobDataHandle that refers to the platform file path prior
     131        // to return from this method so the underlying file will not be deleted.
     132        OwnPtr<BlobData> blobData = BlobData::create();
     133        blobData->appendFile(info.platformPath);
     134        RefPtr<BlobDataHandle> snapshotBlob = BlobDataHandle::create(blobData.release(), info.length);
     135        m_bridge->didCreateSnapshotFileOnMainThread(info, m_mode, snapshotBlob);
     136        delete this;
     137    }
     138
    127139    virtual void didReadDirectory(const WebVector<WebFileSystemEntry>& entries, bool hasMore)
    128140    {
     
    290302}
    291303
    292 void WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread(WebFileSystem* fileSystem, const KURL& internalBlobURL, const KURL& path, const String& mode)
     304void WorkerFileSystemCallbacksBridge::postCreateSnapshotFileToMainThread(WebFileSystem* fileSystem, const KURL& path, const String& mode)
    293305{
    294306    ASSERT(fileSystem);
     
    296308        createCallbackTask(&createSnapshotFileOnMainThread,
    297309                           AllowCrossThreadAccess(fileSystem),
    298                            internalBlobURL, path, this, mode));
     310                           path, this, mode));
    299311}
    300312
     
    358370}
    359371
    360 void WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem* fileSystem, const KURL& internalBlobURL, const KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode)
    361 {
    362     fileSystem->createSnapshotFileAndReadMetadata(internalBlobURL, path, MainThreadFileSystemCallbacks::createLeakedPtr(bridge, mode));
     372void WorkerFileSystemCallbacksBridge::createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem* fileSystem, const KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const String& mode)
     373{
     374    fileSystem->createSnapshotFileAndReadMetadata(path, MainThreadFileSystemCallbacks::createLeakedPtr(bridge, mode));
    363375}
    364376
     
    382394{
    383395    mayPostTaskToWorker(createCallbackTask(&didReadMetadataOnWorkerThread, this, info), mode);
     396}
     397
     398void WorkerFileSystemCallbacksBridge::didCreateSnapshotFileOnMainThread(const WebFileInfo& info, const String& mode, PassRefPtr<BlobDataHandle> snapshotBlob)
     399{
     400    mayPostTaskToWorker(createCallbackTask(&didCreateSnapshotFileOnWorkerThread, this, info, snapshotBlob), mode);
    384401}
    385402
     
    391408}
    392409
    393 WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, ScriptExecutionContext* scriptExecutionContext, WebFileSystemCallbacks* callbacks)
     410WorkerFileSystemCallbacksBridge::WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy* workerLoaderProxy, ScriptExecutionContext* scriptExecutionContext, WebFileSystemCallbacksImpl* callbacks)
    394411    : m_workerLoaderProxy(workerLoaderProxy)
    395412    , m_workerContext(scriptExecutionContext)
     
    425442}
    426443
     444void WorkerFileSystemCallbacksBridge::didCreateSnapshotFileOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const WebFileInfo& info, PassRefPtr<BlobDataHandle> snapshotBlob)
     445{
     446    bridge->m_callbacksOnWorkerThread->didCreateSnapshotFile(info, snapshotBlob);
     447}
     448
    427449void WorkerFileSystemCallbacksBridge::didReadDirectoryOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge> bridge, const WebVector<WebFileSystemEntry>& entries, bool hasMore)
    428450{
  • trunk/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h

    r145452 r145771  
    4444
    4545namespace WebCore {
     46class BlobDataHandle;
    4647class WorkerLoaderProxy;
    4748}
     
    5354class WebCommonWorkerClient;
    5455class ThreadableCallbacksBridgeWrapper;
    55 class WebFileSystemCallbacks;
     56class WebFileSystemCallbacksImpl;
    5657class WorkerFileSystemContextObserver;
    5758struct WebFileInfo;
     
    7879    void stop();
    7980
    80     static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, WebCore::ScriptExecutionContext* workerContext, WebFileSystemCallbacks* callbacks)
     81    static PassRefPtr<WorkerFileSystemCallbacksBridge> create(WebCore::WorkerLoaderProxy* workerLoaderProxy, WebCore::ScriptExecutionContext* workerContext, WebFileSystemCallbacksImpl* callbacks)
    8182    {
    8283        return adoptRef(new WorkerFileSystemCallbacksBridge(workerLoaderProxy, workerContext, callbacks));
     
    9596    void postDirectoryExistsToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode);
    9697    void postReadDirectoryToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode);
    97     void postCreateSnapshotFileToMainThread(WebFileSystem*, const WebCore::KURL& internalBlobURL, const WebCore::KURL& path, const String& mode);
     98    void postCreateSnapshotFileToMainThread(WebFileSystem*, const WebCore::KURL& path, const String& mode);
    9899
    99100    // Callback methods that are called on the main thread.
     
    102103    void didSucceedOnMainThread(const String& mode);
    103104    void didReadMetadataOnMainThread(const WebFileInfo&, const String& mode);
     105    void didCreateSnapshotFileOnMainThread(const WebFileInfo&, const String& mode, PassRefPtr<WebCore::BlobDataHandle> snapshotBlob);
    104106    void didReadDirectoryOnMainThread(const WebVector<WebFileSystemEntry>&, bool hasMore, const String& mode);
    105107
    106108private:
    107     WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy*, WebCore::ScriptExecutionContext*, WebFileSystemCallbacks*);
     109    WorkerFileSystemCallbacksBridge(WebCore::WorkerLoaderProxy*, WebCore::ScriptExecutionContext*, WebFileSystemCallbacksImpl*);
    108110
    109111    // Methods that are to be called on the main thread.
     
    119121    static void directoryExistsOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
    120122    static void readDirectoryOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
    121     static void createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& internalBlobURL, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
     123    static void createSnapshotFileOnMainThread(WebCore::ScriptExecutionContext*, WebFileSystem*, const WebCore::KURL& path, PassRefPtr<WorkerFileSystemCallbacksBridge>, const String& mode);
    122124
    123125    friend class MainThreadFileSystemCallbacks;
     
    128130    static void didSucceedOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge>);
    129131    static void didReadMetadataOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge>, const WebFileInfo&);
     132    static void didCreateSnapshotFileOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge>, const WebFileInfo&, PassRefPtr<WebCore::BlobDataHandle> snapshotBlob);
    130133    static void didReadDirectoryOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileSystemCallbacksBridge>, const WebVector<WebFileSystemEntry>&, bool hasMore);
    131134
     
    147150
    148151    // This is self-destructed and must be fired on the worker thread.
    149     WebFileSystemCallbacks* m_callbacksOnWorkerThread;
     152    WebFileSystemCallbacksImpl* m_callbacksOnWorkerThread;
    150153};
    151154
Note: See TracChangeset for help on using the changeset viewer.