Changeset 116283 in webkit


Ignore:
Timestamp:
May 7, 2012 1:57:37 AM (12 years ago)
Author:
kinuko@chromium.org
Message:

Cleanup: Change boolean synchronous flag argument into enum in FileSystem API code
https://bugs.webkit.org/show_bug.cgi?id=85741

Reviewed by David Levin.

Source/WebCore:

No new tests as this change has no functional effects.

  • Modules/filesystem/DOMWindowFileSystem.cpp:

(WebCore::DOMWindowFileSystem::webkitRequestFileSystem):

  • Modules/filesystem/LocalFileSystem.cpp:

(WebCore::LocalFileSystem::requestFileSystem):

  • Modules/filesystem/LocalFileSystem.h:

(LocalFileSystem):

  • Modules/filesystem/WorkerContextFileSystem.cpp:

(WebCore::WorkerContextFileSystem::webkitRequestFileSystem):
(WebCore::WorkerContextFileSystem::webkitRequestFileSystemSync):
(WebCore::WorkerContextFileSystem::webkitResolveLocalFileSystemSyncURL):

  • platform/FileSystemType.h: Added FileSystemSynchronousType enum.

Source/WebKit/chromium:

  • src/LocalFileSystemChromium.cpp:

(WebCore::openFileSystemHelper):
(WebCore::LocalFileSystem::readFileSystem):
(WebCore::LocalFileSystem::requestFileSystem):

  • src/WebFileSystemCallbacksImpl.cpp:

(WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl):
(WebKit::WebFileSystemCallbacksImpl::didOpenFileSystem):

  • src/WebFileSystemCallbacksImpl.h:

(WebFileSystemCallbacksImpl):

  • src/WorkerAsyncFileSystemChromium.cpp:

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

  • src/WorkerAsyncFileSystemChromium.h:

(WebCore::WorkerAsyncFileSystemChromium::create):
(WorkerAsyncFileSystemChromium):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116282 r116283  
     12012-05-06  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Cleanup: Change boolean synchronous flag argument into enum in FileSystem API code
     4        https://bugs.webkit.org/show_bug.cgi?id=85741
     5
     6        Reviewed by David Levin.
     7
     8        No new tests as this change has no functional effects.
     9
     10        * Modules/filesystem/DOMWindowFileSystem.cpp:
     11        (WebCore::DOMWindowFileSystem::webkitRequestFileSystem):
     12        * Modules/filesystem/LocalFileSystem.cpp:
     13        (WebCore::LocalFileSystem::requestFileSystem):
     14        * Modules/filesystem/LocalFileSystem.h:
     15        (LocalFileSystem):
     16        * Modules/filesystem/WorkerContextFileSystem.cpp:
     17        (WebCore::WorkerContextFileSystem::webkitRequestFileSystem):
     18        (WebCore::WorkerContextFileSystem::webkitRequestFileSystemSync):
     19        (WebCore::WorkerContextFileSystem::webkitResolveLocalFileSystemSyncURL):
     20        * platform/FileSystemType.h: Added FileSystemSynchronousType enum.
     21
    1222012-05-07  Antti Koivisto  <antti@apple.com>
    223
  • trunk/Source/WebCore/Modules/filesystem/DOMWindowFileSystem.cpp

    r116280 r116283  
    3838#include "FileSystemCallback.h"
    3939#include "FileSystemCallbacks.h"
     40#include "FileSystemType.h"
    4041#include "LocalFileSystem.h"
    4142#include "SecurityOrigin.h"
     
    7172    }
    7273
    73     LocalFileSystem::localFileSystem().requestFileSystem(document, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, document), false);
     74    LocalFileSystem::localFileSystem().requestFileSystem(document, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, document), AsynchronousFileSystem);
    7475}
    7576
  • trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.cpp

    r111075 r116283  
    8989}
    9090
    91 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool)
     91void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType)
    9292{
    9393    // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously.
  • trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.h

    r116280 r116283  
    5656
    5757    // Does not create the root path for file system, just reads it if available.
    58     void readFileSystem(ScriptExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);
     58    void readFileSystem(ScriptExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>, FileSystemSynchronousType = AsynchronousFileSystem);
    5959
    60     void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);
     60    void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, FileSystemSynchronousType = AsynchronousFileSystem);
    6161
    6262#if !PLATFORM(CHROMIUM)
  • trunk/Source/WebCore/Modules/filesystem/WorkerContextFileSystem.cpp

    r116280 r116283  
    4242#include "FileSystemCallback.h"
    4343#include "FileSystemCallbacks.h"
     44#include "FileSystemType.h"
    4445#include "LocalFileSystem.h"
    4546#include "SecurityOrigin.h"
     
    6364    }
    6465
    65     LocalFileSystem::localFileSystem().requestFileSystem(worker, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, worker), false);
     66    LocalFileSystem::localFileSystem().requestFileSystem(worker, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, worker), AsynchronousFileSystem);
    6667}
    6768
     
    8283
    8384    FileSystemSyncCallbackHelper helper;
    84     LocalFileSystem::localFileSystem().requestFileSystem(worker, fileSystemType, size, FileSystemCallbacks::create(helper.successCallback(), helper.errorCallback(), worker), true);
     85    LocalFileSystem::localFileSystem().requestFileSystem(worker, fileSystemType, size, FileSystemCallbacks::create(helper.successCallback(), helper.errorCallback(), worker), SynchronousFileSystem);
    8586    return helper.getResult(ec);
    8687}
     
    123124
    124125    FileSystemSyncCallbackHelper readFileSystemHelper;
    125     LocalFileSystem::localFileSystem().readFileSystem(worker, type, FileSystemCallbacks::create(readFileSystemHelper.successCallback(), readFileSystemHelper.errorCallback(), worker), true);
     126    LocalFileSystem::localFileSystem().readFileSystem(worker, type, FileSystemCallbacks::create(readFileSystemHelper.successCallback(), readFileSystemHelper.errorCallback(), worker), SynchronousFileSystem);
    126127    RefPtr<DOMFileSystemSync> fileSystem = readFileSystemHelper.getResult(ec);
    127128    if (!fileSystem)
  • trunk/Source/WebCore/platform/FileSystemType.h

    r116280 r116283  
    5050};
    5151
     52enum FileSystemSynchronousType {
     53    AsynchronousFileSystem,
     54    SynchronousFileSystem,
     55};
     56
    5257} // namespace WebCore
    5358
  • trunk/Source/WebKit/chromium/ChangeLog

    r116280 r116283  
     12012-05-06  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Cleanup: Change boolean synchronous flag argument into enum in FileSystem API code
     4        https://bugs.webkit.org/show_bug.cgi?id=85741
     5
     6        Reviewed by David Levin.
     7
     8        * src/LocalFileSystemChromium.cpp:
     9        (WebCore::openFileSystemHelper):
     10        (WebCore::LocalFileSystem::readFileSystem):
     11        (WebCore::LocalFileSystem::requestFileSystem):
     12        * src/WebFileSystemCallbacksImpl.cpp:
     13        (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl):
     14        (WebKit::WebFileSystemCallbacksImpl::didOpenFileSystem):
     15        * src/WebFileSystemCallbacksImpl.h:
     16        (WebFileSystemCallbacksImpl):
     17        * src/WorkerAsyncFileSystemChromium.cpp:
     18        (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):
     19        (WebCore::WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge):
     20        * src/WorkerAsyncFileSystemChromium.h:
     21        (WebCore::WorkerAsyncFileSystemChromium::create):
     22        (WorkerAsyncFileSystemChromium):
     23
    1242012-05-06  Kinuko Yasuda  <kinuko@chromium.org>
    225
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp

    r116280 r116283  
    5757// For external filesystem.
    5858const char externalPathPrefix[] = "external";
    59 const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1;
    6059
    6160// Specialized callback class for createSnapshotFileAndReadMetadata.
  • trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp

    r116280 r116283  
    154154}
    155155
    156 void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, bool synchronous)
     156void openFileSystemForWorker(WebCommonWorkerClient* commonClient, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks, FileSystemSynchronousType synchronousType)
    157157{
    158158    WorkerScriptController* controller = WorkerScriptController::controllerForContext();
     
    169169    bridge->postOpenFileSystemToMainThread(commonClient, type, size, create, mode);
    170170
    171     if (synchronous) {
     171    if (synchronousType == SynchronousFileSystem) {
    172172        if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated)
    173173            bridge->stop();
     
    184184}
    185185
    186 static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create)
     186static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType, long long size, CreationFlag create)
    187187{
    188188    bool allowed = true;
     
    204204            allowed = false;
    205205        else
    206             openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronous), synchronous);
     206            openFileSystemForWorker(webWorker->commonClient(), static_cast<WebFileSystem::Type>(type), size, create == CreateIfNotPresent, new WebFileSystemCallbacksImpl(callbacks, type, context, synchronousType), synchronousType);
    207207
    208208#else
     
    217217}
    218218
    219 void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
    220 {
    221     openFileSystemHelper(context, type, callbacks, synchronous, 0, OpenExisting);
    222 }
    223 
    224 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
    225 {
    226     openFileSystemHelper(context, type, callbacks, synchronous, size, CreateIfNotPresent);
     219void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType)
     220{
     221    openFileSystemHelper(context, type, callbacks, synchronousType, 0, OpenExisting);
     222}
     223
     224void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemSynchronousType synchronousType)
     225{
     226    openFileSystemHelper(context, type, callbacks, synchronousType, size, CreateIfNotPresent);
    227227}
    228228
  • trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp

    r116280 r116283  
    4848namespace WebKit {
    4949
    50 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, bool synchronous)
     50WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, FileSystemSynchronousType synchronousType)
    5151    : m_callbacks(callbacks)
    5252    , m_type(type)
    5353    , m_context(context)
    54     , m_synchronous(synchronous)
     54    , m_synchronousType(synchronousType)
    5555{
    5656    ASSERT(m_callbacks);
     
    9393#if ENABLE(WORKERS)
    9494    if (m_context && m_context->isWorkerContext()) {
    95         m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, rootURL, m_synchronous));
     95        m_callbacks->didOpenFileSystem(name, WorkerAsyncFileSystemChromium::create(m_context, m_type, rootURL, m_synchronousType));
    9696        return;
    9797    }
  • trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h

    r116280 r116283  
    5353class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks {
    5454public:
    55     WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false);
     55    WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem);
    5656    virtual ~WebFileSystemCallbacksImpl();
    5757
     
    7070    // Used for worker's openFileSystem callbacks.
    7171    WebCore::ScriptExecutionContext* m_context;
    72     bool m_synchronous;
     72    WebCore::FileSystemSynchronousType m_synchronousType;
    7373};
    7474
  • trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp

    r116280 r116283  
    5858static const char fileSystemOperationsMode[] = "fileSystemOperationsMode";
    5959
    60 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, bool synchronous)
     60WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType)
    6161    : AsyncFileSystemChromium(type, rootURL)
    6262    , m_scriptExecutionContext(context)
    6363    , m_workerContext(static_cast<WorkerContext*>(context))
    64     , m_synchronous(synchronous)
     64    , m_synchronousType(synchronousType)
    6565{
    6666    ASSERT(m_scriptExecutionContext->isWorkerContext());
     
    220220PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    221221{
    222     ASSERT(!m_synchronous || !m_bridgeForCurrentOperation);
     222    ASSERT(m_synchronousType == AsynchronousFileSystem || !m_bridgeForCurrentOperation);
    223223
    224224    m_modeForCurrentOperation = fileSystemOperationsMode;
  • trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h

    r116280 r116283  
    3535
    3636#include "AsyncFileSystemChromium.h"
     37#include "FileSystemType.h"
    3738#include <wtf/PassOwnPtr.h>
    3839#include <wtf/RefPtr.h>
     
    5354class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium {
    5455public:
    55     static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, bool synchronous)
     56    static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, FileSystemSynchronousType synchronousType)
    5657    {
    57         return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronous));
     58        return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronousType));
    5859    }
    5960
     
    7778
    7879private:
    79     WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, bool synchronous);
     80    WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, FileSystemSynchronousType);
    8081
    8182    PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>);
     
    8687    RefPtr<WebKit::WorkerFileSystemCallbacksBridge> m_bridgeForCurrentOperation;
    8788    String m_modeForCurrentOperation;
    88     bool m_synchronous;
     89    FileSystemSynchronousType m_synchronousType;
    8990};
    9091
Note: See TracChangeset for help on using the changeset viewer.