Changeset 116280 in webkit


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

Cleanup: Move FileSystem API type definitions into a separate header file
https://bugs.webkit.org/show_bug.cgi?id=85738

Reviewed by David Levin.

Move FileSystem API type definitions from AsyncFileSystem.h and
AsyncFileSystemChromium.cpp for chromium port into a single separate
header file: FileSystemType.h

By doing this we make it clearer that every filesystem type can be
found in the header file and also can save including entire
AsyncFileSystem definition just for referring type enum value.

Source/WebCore:

No new tests as this change has no visible or functional changes.

  • Modules/filesystem/DOMFileSystemBase.cpp:

(WebCore::pathToAbsolutePath):

  • Modules/filesystem/DOMWindowFileSystem.cpp:

(WebCore::DOMWindowFileSystem::webkitRequestFileSystem):
(WebCore::DOMWindowFileSystem::webkitResolveLocalFileSystemURL):
(WebCore):

  • Modules/filesystem/DOMWindowFileSystem.h:
  • Modules/filesystem/LocalFileSystem.h:

(LocalFileSystem):

  • Modules/filesystem/WorkerContextFileSystem.cpp:

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

  • Modules/filesystem/WorkerContextFileSystem.h:
  • platform/AsyncFileSystem.cpp:

(WebCore::AsyncFileSystem::isValidType):
(WebCore::AsyncFileSystem::create):
(WebCore::AsyncFileSystem::openFileSystem):

  • platform/AsyncFileSystem.h:

(AsyncFileSystem):
(WebCore::AsyncFileSystem::type):
(WebCore::AsyncFileSystem::AsyncFileSystem):

  • platform/FileSystemType.h: Added.

(WebCore):

  • platform/blackberry/AsyncFileSystemBlackBerry.cpp:

(WebCore::AsyncFileSystem::isValidType):
(WebCore::AsyncFileSystem::create):
(WebCore::AsyncFileSystem::openFileSystem):
(WebCore::AsyncFileSystem::crackFileSystemURL):
(WebCore::AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry):

  • platform/blackberry/AsyncFileSystemBlackBerry.h:

(AsyncFileSystemBlackBerry):

  • platform/gtk/AsyncFileSystemGtk.cpp:

(WebCore::AsyncFileSystem::isValidType):
(WebCore::AsyncFileSystem::create):
(WebCore::AsyncFileSystem::openFileSystem):
(WebCore::AsyncFileSystem::crackFileSystemURL):
(WebCore::AsyncFileSystemGtk::AsyncFileSystemGtk):

  • platform/gtk/AsyncFileSystemGtk.h:

(AsyncFileSystemGtk):

Source/WebKit/chromium:

  • src/AssertMatchingEnums.cpp:
  • src/AsyncFileSystemChromium.cpp:

(WebCore::AsyncFileSystem::crackFileSystemURL):
(WebCore::AsyncFileSystem::isValidType):
(WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium):
(WebCore::AsyncFileSystemChromium::createIsolatedFileSystem):
(WebCore::AsyncFileSystemChromium::toURL):

  • src/AsyncFileSystemChromium.h:

(WebCore::AsyncFileSystemChromium::create):
(AsyncFileSystemChromium):

  • src/LocalFileSystemChromium.cpp:

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

  • src/WebFileSystemCallbacksImpl.cpp:

(WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl):

  • src/WebFileSystemCallbacksImpl.h:

(WebFileSystemCallbacksImpl):

  • src/WebFrameImpl.cpp:

(WebKit::WebFrameImpl::createFileSystem):
(WebKit::WebFrameImpl::createFileEntry):

  • src/WorkerAsyncFileSystemChromium.cpp:

(WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):

  • src/WorkerAsyncFileSystemChromium.h:

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

Location:
trunk/Source
Files:
23 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116277 r116280  
     12012-05-06  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Cleanup: Move FileSystem API type definitions into a separate header file
     4        https://bugs.webkit.org/show_bug.cgi?id=85738
     5
     6        Reviewed by David Levin.
     7
     8        Move FileSystem API type definitions from AsyncFileSystem.h and
     9        AsyncFileSystemChromium.cpp for chromium port into a single separate
     10        header file: FileSystemType.h
     11
     12        By doing this we make it clearer that every filesystem type can be
     13        found in the header file and also can save including entire
     14        AsyncFileSystem definition just for referring type enum value.
     15
     16        No new tests as this change has no visible or functional changes.
     17
     18        * Modules/filesystem/DOMFileSystemBase.cpp:
     19        (WebCore::pathToAbsolutePath):
     20        * Modules/filesystem/DOMWindowFileSystem.cpp:
     21        (WebCore::DOMWindowFileSystem::webkitRequestFileSystem):
     22        (WebCore::DOMWindowFileSystem::webkitResolveLocalFileSystemURL):
     23        (WebCore):
     24        * Modules/filesystem/DOMWindowFileSystem.h:
     25        * Modules/filesystem/LocalFileSystem.h:
     26        (LocalFileSystem):
     27        * Modules/filesystem/WorkerContextFileSystem.cpp:
     28        (WebCore::WorkerContextFileSystem::webkitRequestFileSystem):
     29        (WebCore::WorkerContextFileSystem::webkitRequestFileSystemSync):
     30        (WebCore::WorkerContextFileSystem::webkitResolveLocalFileSystemURL):
     31        (WebCore::WorkerContextFileSystem::webkitResolveLocalFileSystemSyncURL):
     32        (WebCore):
     33        * Modules/filesystem/WorkerContextFileSystem.h:
     34        * platform/AsyncFileSystem.cpp:
     35        (WebCore::AsyncFileSystem::isValidType):
     36        (WebCore::AsyncFileSystem::create):
     37        (WebCore::AsyncFileSystem::openFileSystem):
     38        * platform/AsyncFileSystem.h:
     39        (AsyncFileSystem):
     40        (WebCore::AsyncFileSystem::type):
     41        (WebCore::AsyncFileSystem::AsyncFileSystem):
     42        * platform/FileSystemType.h: Added.
     43        (WebCore):
     44        * platform/blackberry/AsyncFileSystemBlackBerry.cpp:
     45        (WebCore::AsyncFileSystem::isValidType):
     46        (WebCore::AsyncFileSystem::create):
     47        (WebCore::AsyncFileSystem::openFileSystem):
     48        (WebCore::AsyncFileSystem::crackFileSystemURL):
     49        (WebCore::AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry):
     50        * platform/blackberry/AsyncFileSystemBlackBerry.h:
     51        (AsyncFileSystemBlackBerry):
     52        * platform/gtk/AsyncFileSystemGtk.cpp:
     53        (WebCore::AsyncFileSystem::isValidType):
     54        (WebCore::AsyncFileSystem::create):
     55        (WebCore::AsyncFileSystem::openFileSystem):
     56        (WebCore::AsyncFileSystem::crackFileSystemURL):
     57        (WebCore::AsyncFileSystemGtk::AsyncFileSystemGtk):
     58        * platform/gtk/AsyncFileSystemGtk.h:
     59        (AsyncFileSystemGtk):
     60
    1612012-05-06  MORITA Hajime  <morrita@google.com>
    262
  • trunk/Source/WebCore/Modules/filesystem/DOMFileSystemBase.cpp

    r111075 r116280  
    100100}
    101101
    102 static bool pathToAbsolutePath(AsyncFileSystem::Type type, const EntryBase* base, String path, String& absolutePath)
     102static bool pathToAbsolutePath(FileSystemType type, const EntryBase* base, String path, String& absolutePath)
    103103{
    104104    ASSERT(base);
     
    108108    absolutePath = DOMFilePath::removeExtraParentReferences(path);
    109109
    110     if ((type == AsyncFileSystem::Temporary || type == AsyncFileSystem::Persistent) && !DOMFilePath::isValidPath(absolutePath))
     110    if ((type == FileSystemTypeTemporary || type == FileSystemTypePersistent) && !DOMFilePath::isValidPath(absolutePath))
    111111        return false;
    112112    return true;
  • trunk/Source/WebCore/Modules/filesystem/DOMWindowFileSystem.cpp

    r110957 r116280  
    6565    }
    6666
    67     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
     67    FileSystemType fileSystemType = static_cast<FileSystemType>(type);
    6868    if (!AsyncFileSystem::isValidType(fileSystemType)) {
    6969        DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
     
    9090    }
    9191
    92     AsyncFileSystem::Type type;
     92    FileSystemType type;
    9393    String filePath;
    9494    if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
     
    100100}
    101101
    102 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch);
    103 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch);
     102COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<int>(FileSystemTypeTemporary), enum_mismatch);
     103COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<int>(FileSystemTypePersistent), enum_mismatch);
    104104
    105105} // namespace WebCore
  • trunk/Source/WebCore/Modules/filesystem/DOMWindowFileSystem.h

    r110957 r116280  
    4747    // They are placed here and in all capital letters so they can be checked against the constants in the
    4848    // IDL at compile time.
    49     enum FileSystemType {
     49    enum {
    5050        TEMPORARY,
    5151        PERSISTENT,
  • trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.h

    r113537 r116280  
    3434#if ENABLE(FILE_SYSTEM)
    3535
    36 #include "AsyncFileSystem.h"
     36#include "AsyncFileSystemCallbacks.h"
     37#include "FileSystemType.h"
    3738#include "PlatformString.h"
    3839#include <wtf/PassRefPtr.h>
     
    5556
    5657    // Does not create the root path for file system, just reads it if available.
    57     void readFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);
     58    void readFileSystem(ScriptExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);
    5859
    59     void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);
     60    void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);
    6061
    6162#if !PLATFORM(CHROMIUM)
  • trunk/Source/WebCore/Modules/filesystem/WorkerContextFileSystem.cpp

    r111075 r116280  
    5757    }
    5858
    59     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
     59    FileSystemType fileSystemType = static_cast<FileSystemType>(type);
    6060    if (!AsyncFileSystem::isValidType(fileSystemType)) {
    6161        DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
     
    7575    }
    7676
    77     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
     77    FileSystemType fileSystemType = static_cast<FileSystemType>(type);
    7878    if (!AsyncFileSystem::isValidType(fileSystemType)) {
    7979        ec = FileException::INVALID_MODIFICATION_ERR;
     
    9595    }
    9696
    97     AsyncFileSystem::Type type;
     97    FileSystemType type;
    9898    String filePath;
    9999    if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
     
    115115    }
    116116
    117     AsyncFileSystem::Type type;
     117    FileSystemType type;
    118118    String filePath;
    119119    if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
     
    135135}
    136136
    137 COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch);
    138 COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch);
     137COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::TEMPORARY) == static_cast<int>(FileSystemTypeTemporary), enum_mismatch);
     138COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::PERSISTENT) == static_cast<int>(FileSystemTypePersistent), enum_mismatch);
    139139
    140140} // namespace WebCore
  • trunk/Source/WebCore/Modules/filesystem/WorkerContextFileSystem.h

    r111075 r116280  
    4343class WorkerContextFileSystem {
    4444public:
    45     enum FileSystemType {
     45    enum {
    4646        TEMPORARY,
    4747        PERSISTENT,
  • trunk/Source/WebCore/platform/AsyncFileSystem.cpp

    r112106 r116280  
    5353}
    5454
    55 bool AsyncFileSystem::isValidType(Type type)
     55bool AsyncFileSystem::isValidType(FileSystemType type)
    5656{
    57     return type == Temporary || type == Persistent;
     57    return type == FileSystemTypeTemporary || type == FileSystemTypePersistent;
    5858}
    5959
    60 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type)
     60PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(FileSystemType)
    6161{
    6262    notImplemented();
     
    6464}
    6565
    66 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
     66void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    6767{
    6868    notImplemented();
  • trunk/Source/WebCore/platform/AsyncFileSystem.h

    r116273 r116280  
    3434#if ENABLE(FILE_SYSTEM)
    3535
     36#include "FileSystemType.h"
    3637#include "KURL.h"
    3738#include "PlatformString.h"
     
    5152    virtual ~AsyncFileSystem() { }
    5253
    53     // FileSystem type
    54     enum Type {
    55         Temporary,
    56         Persistent,
    57     };
    58 
    5954    // Path prefixes that are used in the filesystem URLs (that can be obtained by toURL()).
    6055    // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL
     
    6964    static bool isAvailable();
    7065
    71     static bool isValidType(Type);
     66    static bool isValidType(FileSystemType);
    7267
    73     static bool crackFileSystemURL(const KURL&, Type&, String& filePath);
     68    static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePath);
    7469
    7570    virtual KURL toURL(const String& originString, const String& fullPath) const = 0;
     
    8075
    8176    // Creates and returns a new platform-specific AsyncFileSystem instance if the platform has its own implementation.
    82     static PassOwnPtr<AsyncFileSystem> create(Type);
     77    static PassOwnPtr<AsyncFileSystem> create(FileSystemType);
    8378
    8479    // Opens a new file system. The create parameter specifies whether or not to create the path if it does not already exists.
    85     static void openFileSystem(const String& basePath, const String& storageIdentifier, Type, bool create, PassOwnPtr<AsyncFileSystemCallbacks>);
     80    static void openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, bool create, PassOwnPtr<AsyncFileSystemCallbacks>);
    8681
    8782    // Moves a file or directory from srcPath to destPath.
     
    148143    virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0;
    149144
    150     Type type() const { return m_type; }
     145    FileSystemType type() const { return m_type; }
    151146
    152147protected:
    153     AsyncFileSystem(Type type)
     148    AsyncFileSystem(FileSystemType type)
    154149        : m_type(type)
    155150    {
    156151    }
    157152
    158     Type m_type;
     153    FileSystemType m_type;
    159154};
    160155
  • trunk/Source/WebCore/platform/FileSystemType.h

    r116279 r116280  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929 */
    3030
    31 #include "config.h"
    32 #include "AsyncFileSystem.h"
     31#ifndef FileSystemType_h
     32#define FileSystemType_h
    3333
    3434#if ENABLE(FILE_SYSTEM)
    3535
    36 #include "AsyncFileSystemCallbacks.h"
    37 #include "ExceptionCode.h"
    38 #include "FileSystem.h"
    39 #include "NotImplemented.h"
    40 
    4136namespace WebCore {
    4237
    43 const char AsyncFileSystem::persistentPathPrefix[] = "persistent";
    44 const size_t AsyncFileSystem::persistentPathPrefixLength = sizeof(AsyncFileSystem::persistentPathPrefix) - 1;
    45 const char AsyncFileSystem::temporaryPathPrefix[] = "temporary";
    46 const size_t AsyncFileSystem::temporaryPathPrefixLength = sizeof(AsyncFileSystem::temporaryPathPrefix) - 1;
     38// For file system types used in FileSystem API.
     39enum FileSystemType {
     40    FileSystemTypeTemporary,
     41    FileSystemTypePersistent,
    4742
    48 #if !PLATFORM(CHROMIUM) && !PLATFORM(GTK) && !PLATFORM(BLACKBERRY)
    49 bool AsyncFileSystem::isAvailable()
    50 {
    51     notImplemented();
    52     return false;
    53 }
     43#if PLATFORM(CHROMIUM)
     44    // Temporary isolated non-sandbox filesystem.
     45    FileSystemTypeIsolated,
    5446
    55 bool AsyncFileSystem::isValidType(Type type)
    56 {
    57     return type == Temporary || type == Persistent;
    58 }
     47    // Non-sandbox filesystem.
     48    FileSystemTypeExternal,
     49#endif
     50};
    5951
    60 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type)
    61 {
    62     notImplemented();
    63     return nullptr;
    64 }
    65 
    66 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    67 {
    68     notImplemented();
    69     callbacks->didFail(NOT_SUPPORTED_ERR);
    70 }
    71 #endif
    72 
    73 } // namespace
     52} // namespace WebCore
    7453
    7554#endif // ENABLE(FILE_SYSTEM)
     55
     56#endif // FileSystemType_h
  • trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp

    r116273 r116280  
    3636}
    3737
    38 bool AsyncFileSystem::isValidType(Type type)
     38bool AsyncFileSystem::isValidType(FileSystemType type)
    3939{
    4040    UNUSED_PARAM(type);
     
    4444}
    4545
    46 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type type)
     46PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(FileSystemType type)
    4747{
    4848    return adoptPtr(new AsyncFileSystemBlackBerry(type));
    4949}
    5050
    51 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
     51void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    5252{
    5353    UNUSED_PARAM(basePath);
     
    6060}
    6161
    62 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
     62bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath)
    6363{
    6464    UNUSED_PARAM(url);
     
    7070}
    7171
    72 AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry(AsyncFileSystem::Type type)
     72AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry(FileSystemType type)
    7373    : AsyncFileSystem(type)
    7474{
  • trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.h

    r116273 r116280  
    2828class AsyncFileSystemBlackBerry : public AsyncFileSystem {
    2929public:
    30     AsyncFileSystemBlackBerry(AsyncFileSystem::Type);
     30    AsyncFileSystemBlackBerry(FileSystemType);
    3131    virtual ~AsyncFileSystemBlackBerry();
    3232    virtual KURL toURL(const String& originString, const String& fullPath) const;
  • trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp

    r116273 r116280  
    3636}
    3737
    38 bool AsyncFileSystem::isValidType(Type type)
     38bool AsyncFileSystem::isValidType(FileSystemType type)
    3939{
    4040    notImplemented();
     
    4242}
    4343
    44 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type type)
     44PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(FileSystemType type)
    4545{
    4646    return adoptPtr(new AsyncFileSystemGtk(type));
    4747}
    4848
    49 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
     49void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
    5050{
    5151    notImplemented();
     
    5353}
    5454
    55 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
     55bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath)
    5656{
    5757    notImplemented();
     
    5959}
    6060
    61 AsyncFileSystemGtk::AsyncFileSystemGtk(AsyncFileSystem::Type type)
     61AsyncFileSystemGtk::AsyncFileSystemGtk(FileSystemType type)
    6262    : AsyncFileSystem(type)
    6363{
  • trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.h

    r116273 r116280  
    3232class AsyncFileSystemGtk : public AsyncFileSystem {
    3333public:
    34     AsyncFileSystemGtk(AsyncFileSystem::Type);
     34    AsyncFileSystemGtk(FileSystemType);
    3535    virtual ~AsyncFileSystemGtk();
    3636
  • trunk/Source/WebKit/chromium/ChangeLog

    r116273 r116280  
     12012-05-06  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Cleanup: Move FileSystem API type definitions into a separate header file
     4        https://bugs.webkit.org/show_bug.cgi?id=85738
     5
     6        Reviewed by David Levin.
     7
     8        Move FileSystem API type definitions from AsyncFileSystem.h and
     9        AsyncFileSystemChromium.cpp for chromium port into a single separate
     10        header file: FileSystemType.h
     11
     12        By doing this we make it clearer that every filesystem type can be
     13        found in the header file and also can save including entire
     14        AsyncFileSystem definition just for referring type enum value.
     15
     16        * src/AssertMatchingEnums.cpp:
     17        * src/AsyncFileSystemChromium.cpp:
     18        (WebCore::AsyncFileSystem::crackFileSystemURL):
     19        (WebCore::AsyncFileSystem::isValidType):
     20        (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium):
     21        (WebCore::AsyncFileSystemChromium::createIsolatedFileSystem):
     22        (WebCore::AsyncFileSystemChromium::toURL):
     23        * src/AsyncFileSystemChromium.h:
     24        (WebCore::AsyncFileSystemChromium::create):
     25        (AsyncFileSystemChromium):
     26        * src/LocalFileSystemChromium.cpp:
     27        (WebCore::openFileSystemHelper):
     28        (WebCore::LocalFileSystem::readFileSystem):
     29        (WebCore::LocalFileSystem::requestFileSystem):
     30        * src/WebFileSystemCallbacksImpl.cpp:
     31        (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl):
     32        * src/WebFileSystemCallbacksImpl.h:
     33        (WebFileSystemCallbacksImpl):
     34        * src/WebFrameImpl.cpp:
     35        (WebKit::WebFrameImpl::createFileSystem):
     36        (WebKit::WebFrameImpl::createFileEntry):
     37        * src/WorkerAsyncFileSystemChromium.cpp:
     38        (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium):
     39        * src/WorkerAsyncFileSystemChromium.h:
     40        (WebCore::WorkerAsyncFileSystemChromium::create):
     41        (WorkerAsyncFileSystemChromium):
     42
    1432012-05-06  Kinuko Yasuda  <kinuko@chromium.org>
    244
  • trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp

    r116127 r116280  
    3737#include "AccessibilityObject.h"
    3838#include "ApplicationCacheHost.h"
    39 #include "AsyncFileSystem.h"
    4039#include "ContentSecurityPolicy.h"
    4140#include "DocumentMarker.h"
     
    4443#include "FileError.h"
    4544#include "FileMetadata.h"
     45#include "FileSystemType.h"
    4646#include "FilterOperation.h"
    4747#include "FontDescription.h"
     
    471471
    472472#if ENABLE(FILE_SYSTEM)
    473 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary);
    474 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent);
     473COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, FileSystemTypeTemporary);
     474COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, FileSystemTypePersistent);
     475COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeExternal, FileSystemTypeExternal);
     476COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeIsolated, FileSystemTypeIsolated);
    475477COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown);
    476478COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile);
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp

    r116273 r116280  
    5353
    5454// For isolated filesystem.
    55 const AsyncFileSystem::Type isolatedType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeIsolated);
    5655const char isolatedPathPrefix[] = "isolated";
    5756
    5857// For external filesystem.
    59 const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);
    6058const char externalPathPrefix[] = "external";
    6159const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1;
     
    106104
    107105// static
    108 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)
     106bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath)
    109107{
    110108    if (!url.protocolIs("filesystem"))
     
    114112        String typeString = url.innerURL()->path().substring(1);
    115113        if (typeString == temporaryPathPrefix)
    116             type = Temporary;
     114            type = FileSystemTypeTemporary;
    117115        else if (typeString == persistentPathPrefix)
    118             type = Persistent;
     116            type = FileSystemTypePersistent;
    119117        else if (typeString == externalPathPrefix)
    120             type = externalType;
     118            type = FileSystemTypeExternal;
    121119        else
    122120            return false;
    123121
    124122        filePath = decodeURLEscapeSequences(url.path());
    125     } else {
    126         // FIXME: Remove this clause once http://codereview.chromium.org/7811006
    127         // lands, which makes this dead code.
    128         KURL originURL(ParsedURLString, url.path());
    129         String path = decodeURLEscapeSequences(originURL.path());
    130         if (path.isEmpty() || path[0] != '/')
    131             return false;
    132         path = path.substring(1);
    133 
    134         if (path.startsWith(temporaryPathPrefix)) {
    135             type = Temporary;
    136             path = path.substring(temporaryPathPrefixLength);
    137         } else if (path.startsWith(persistentPathPrefix)) {
    138             type = Persistent;
    139             path = path.substring(persistentPathPrefixLength);
    140         } else if (path.startsWith(externalPathPrefix)) {
    141             type = externalType;
    142             path = path.substring(externalPathPrefixLength);
    143         } else
    144             return false;
    145 
    146         if (path.isEmpty() || path[0] != '/')
    147             return false;
    148 
    149         filePath.swap(path);
    150123    }
    151124    return true;
     
    153126
    154127// static
    155 bool AsyncFileSystem::isValidType(Type type)
    156 {
    157     return type == Temporary || type == Persistent || type == static_cast<Type>(WebKit::WebFileSystem::TypeExternal);
    158 }
    159 
    160 AsyncFileSystemChromium::AsyncFileSystemChromium(AsyncFileSystem::Type type, const KURL& rootURL)
     128bool AsyncFileSystem::isValidType(FileSystemType type)
     129{
     130    return type == FileSystemTypeTemporary || type == FileSystemTypePersistent || type == FileSystemTypeExternal;
     131}
     132
     133AsyncFileSystemChromium::AsyncFileSystemChromium(FileSystemType type, const KURL& rootURL)
    161134    : AsyncFileSystem(type)
    162135    , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem())
     
    192165    rootURL.append("/");
    193166
    194     return AsyncFileSystemChromium::create(isolatedType, KURL(ParsedURLString, rootURL.toString()));
     167    return AsyncFileSystemChromium::create(FileSystemTypeIsolated, KURL(ParsedURLString, rootURL.toString()));
    195168}
    196169
     
    206179
    207180    // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue).
    208     if (type() == isolatedType)
     181    if (type() == FileSystemTypeIsolated)
    209182        return KURL();
    210183
    211     if (type() == externalType) {
     184    if (type() == FileSystemTypeExternal) {
    212185        // For external filesystem originString could be different from what we have in m_filesystemRootURL.
    213186        StringBuilder result;
  • trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h

    r116273 r116280  
    4848class AsyncFileSystemChromium : public AsyncFileSystem {
    4949public:
    50     static PassOwnPtr<AsyncFileSystem> create(AsyncFileSystem::Type type, const KURL& rootURL)
     50    static PassOwnPtr<AsyncFileSystem> create(FileSystemType type, const KURL& rootURL)
    5151    {
    5252        return adoptPtr(new AsyncFileSystemChromium(type, rootURL));
     
    7373
    7474protected:
    75     AsyncFileSystemChromium(AsyncFileSystem::Type, const KURL& rootURL);
     75    AsyncFileSystemChromium(FileSystemType, const KURL& rootURL);
    7676
    7777    PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const;
  • trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp

    r113204 r116280  
    3434#if ENABLE(FILE_SYSTEM)
    3535
    36 #include "AsyncFileSystem.h"
    3736#include "CrossThreadTask.h"
    3837#include "Document.h"
     
    4039#include "FileSystemCallback.h"
    4140#include "FileSystemCallbacks.h"
     41#include "FileSystemType.h"
    4242#include "PlatformString.h"
    4343#include "WebFileError.h"
     
    184184}
    185185
    186 static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create)
     186static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create)
    187187{
    188188    bool allowed = true;
     
    217217}
    218218
    219 void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
     219void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
    220220{
    221221    openFileSystemHelper(context, type, callbacks, synchronous, 0, OpenExisting);
    222222}
    223223
    224 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
     224void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)
    225225{
    226226    openFileSystemHelper(context, type, callbacks, synchronous, size, CreateIfNotPresent);
  • trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp

    r102044 r116280  
    4848namespace WebKit {
    4949
    50 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, AsyncFileSystem::Type type, WebCore::ScriptExecutionContext* context, bool synchronous)
     50WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, bool synchronous)
    5151    : m_callbacks(callbacks)
    5252    , m_type(type)
  • trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h

    r102044 r116280  
    3232#define WebFileSystemCallbacksImpl_h
    3333
    34 #include "AsyncFileSystem.h"
     34#include "FileSystemType.h"
     35#include "WebFileSystemCallbacks.h"
    3536#include "platform/WebFileSystem.h"
    36 #include "WebFileSystemCallbacks.h"
    3737#include "platform/WebVector.h"
    3838#include <wtf/OwnPtr.h>
     
    5353class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks {
    5454public:
    55     WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::AsyncFileSystem::Type = WebCore::AsyncFileSystem::Temporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false);
     55    WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false);
    5656    virtual ~WebFileSystemCallbacksImpl();
    5757
     
    6666
    6767    // Used for openFileSystem callbacks.
    68     WebCore::AsyncFileSystem::Type m_type;
     68    WebCore::FileSystemType m_type;
    6969
    7070    // Used for worker's openFileSystem callbacks.
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp

    r115760 r116280  
    8686#include "EventHandler.h"
    8787#include "EventListenerWrapper.h"
     88#include "FileSystemType.h"
    8889#include "FocusController.h"
    8990#include "FontCache.h"
     
    939940                                                     const WebString& path)
    940941{
    941     return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<AsyncFileSystem::Type>(type), KURL(ParsedURLString, path.utf8().data()))));
     942    return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()))));
    942943}
    943944
     
    948949                                                    bool isDirectory)
    949950{
    950     RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<AsyncFileSystem::Type>(type), KURL(ParsedURLString, fileSystemPath.utf8().data())));
     951    RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data())));
    951952    if (isDirectory)
    952953        return toV8(DirectoryEntry::create(fileSystem, filePath));
  • trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp

    r109324 r116280  
    5858static const char fileSystemOperationsMode[] = "fileSystemOperationsMode";
    5959
    60 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)
     60WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, bool synchronous)
    6161    : AsyncFileSystemChromium(type, rootURL)
    6262    , m_scriptExecutionContext(context)
  • trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h

    r109324 r116280  
    3535
    3636#include "AsyncFileSystemChromium.h"
    37 #include "PlatformString.h"
    3837#include <wtf/PassOwnPtr.h>
    3938#include <wtf/RefPtr.h>
     
    5453class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium {
    5554public:
    56     static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)
     55    static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, bool synchronous)
    5756    {
    5857        return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronous));
     
    7877
    7978private:
    80     WorkerAsyncFileSystemChromium(ScriptExecutionContext*, AsyncFileSystem::Type, const WebKit::WebURL& rootURL, bool synchronous);
     79    WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, bool synchronous);
    8180
    8281    PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>);
Note: See TracChangeset for help on using the changeset viewer.