Changeset 69907 in webkit


Ignore:
Timestamp:
Oct 15, 2010 7:05:55 PM (14 years ago)
Author:
kinuko@chromium.org
Message:

2010-10-15 Kinuko Yasuda <kinuko@google.com>

Reviewed by Jian Li.

Implement FileEntrySync.file() in FileSystem API
https://bugs.webkit.org/show_bug.cgi?id=47310

Tests: fast/filesystem/workers/file-from-file-entry-sync.html

fast/filesystem/workers/file-from-file-entry.html

  • fileapi/DOMFileSystem.cpp: (WebCore::DOMFileSystem::createFile): Added.
  • fileapi/DOMFileSystem.h:
  • fileapi/DOMFileSystemSync.cpp: (WebCore::DOMFileSystemSync::createFile): Added.
  • fileapi/DOMFileSystemSync.h:
  • fileapi/DirectoryReaderBase.h: Added 'virtual path' comment.
  • fileapi/EntryBase.h: Added 'virtual path' comment.
  • fileapi/FileEntry.cpp: (WebCore::FileEntry::file): Changed to use DOMFileSystem::createFile.
  • fileapi/FileEntrySync.cpp: (WebCore::FileEntrySync::file): Implemented.
  • fileapi/FileEntrySync.h:
  • fileapi/FileEntrySync.idl: Added file().

2010-10-15 Kinuko Yasuda <kinuko@chromium.org>

Reviewed by Jian Li.

Implement FileEntrySync.file() in FileSystem API
https://bugs.webkit.org/show_bug.cgi?id=47310

  • fast/filesystem/file-from-file-entry-expected.txt:
  • fast/filesystem/file-from-file-entry.html:
  • fast/filesystem/resources/file-from-file-entry-sync.js: Added.
  • fast/filesystem/resources/file-from-file-entry.js: Added.
  • fast/filesystem/script-tests/file-from-file-entry.js: Moved to resources to make it available for workers tests too.
  • fast/filesystem/workers/file-from-file-entry-expected.txt: Added.
  • fast/filesystem/workers/file-from-file-entry-sync-expected.txt: Added.
  • fast/filesystem/workers/file-from-file-entry-sync.html: Added.
  • fast/filesystem/workers/file-from-file-entry.html: Added.
Location:
trunk
Files:
5 added
14 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r69906 r69907  
     12010-10-15  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Reviewed by Jian Li.
     4
     5        Implement FileEntrySync.file() in FileSystem API
     6        https://bugs.webkit.org/show_bug.cgi?id=47310
     7
     8        * fast/filesystem/file-from-file-entry-expected.txt:
     9        * fast/filesystem/file-from-file-entry.html:
     10        * fast/filesystem/resources/file-from-file-entry-sync.js: Added.
     11        * fast/filesystem/resources/file-from-file-entry.js: Added.
     12        * fast/filesystem/script-tests/file-from-file-entry.js: Moved to
     13        resources to make it available for workers tests too.
     14        * fast/filesystem/workers/file-from-file-entry-expected.txt: Added.
     15        * fast/filesystem/workers/file-from-file-entry-sync-expected.txt: Added.
     16        * fast/filesystem/workers/file-from-file-entry-sync.html: Added.
     17        * fast/filesystem/workers/file-from-file-entry.html: Added.
     18
    1192010-10-15  Oliver Hunt  <oliver@apple.com>
    220
  • trunk/LayoutTests/fast/filesystem/file-from-file-entry-expected.txt

    r69165 r69907  
    1 Obtaining File from FileEntry
     1Obtaining File from FileEntry.
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
  • trunk/LayoutTests/fast/filesystem/file-from-file-entry.html

    r69165 r69907  
    88<p id="description"></p>
    99<div id="console"></div>
    10 <script src="script-tests/file-from-file-entry.js"></script>
     10<script src="resources/file-from-file-entry.js"></script>
    1111<script src="../js/resources/js-test-post.js"></script>
    1212</body>
  • trunk/LayoutTests/fast/filesystem/resources/file-from-file-entry.js

    r69905 r69907  
    1 description("Obtaining File from FileEntry");
     1if (this.importScripts) {
     2    importScripts('fs-worker-common.js');
     3    importScripts('fs-test-util.js');
     4}
     5
     6description("Obtaining File from FileEntry.");
    27
    38var fileSystem = null;
     
    3338}
    3439
    35 if (window.requestFileSystem) {
    36     window.jsTestIsAsync = true;
    37     requestFileSystem(window.TEMPORARY, 100, fileSystemCallback, errorCallback);
    38 } else
    39     debug("This test requires FileSystem API support.");
    40 
    41 window.successfullyParsed = true;
     40var jsTestIsAsync = true;
     41requestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);
     42var successfullyParsed = true;
  • trunk/WebCore/ChangeLog

    r69901 r69907  
     12010-10-15  Kinuko Yasuda  <kinuko@google.com>
     2
     3        Reviewed by Jian Li.
     4
     5        Implement FileEntrySync.file() in FileSystem API
     6        https://bugs.webkit.org/show_bug.cgi?id=47310
     7
     8        Tests: fast/filesystem/workers/file-from-file-entry-sync.html
     9               fast/filesystem/workers/file-from-file-entry.html
     10
     11        * fileapi/DOMFileSystem.cpp:
     12        (WebCore::DOMFileSystem::createFile): Added.
     13        * fileapi/DOMFileSystem.h:
     14        * fileapi/DOMFileSystemSync.cpp:
     15        (WebCore::DOMFileSystemSync::createFile): Added.
     16        * fileapi/DOMFileSystemSync.h:
     17        * fileapi/DirectoryReaderBase.h: Added 'virtual path' comment.
     18        * fileapi/EntryBase.h: Added 'virtual path' comment.
     19        * fileapi/FileEntry.cpp:
     20        (WebCore::FileEntry::file): Changed to use DOMFileSystem::createFile.
     21        * fileapi/FileEntrySync.cpp:
     22        (WebCore::FileEntrySync::file): Implemented.
     23        * fileapi/FileEntrySync.h:
     24        * fileapi/FileEntrySync.idl: Added file().
     25
    1262010-10-15  Nico Weber  <thakis@chromium.org>
    227
  • trunk/WebCore/fileapi/DOMFileSystem.cpp

    r69249 r69907  
    3838#include "DirectoryEntry.h"
    3939#include "ErrorCallback.h"
     40#include "File.h"
    4041#include "FileEntry.h"
    4142#include "FileSystemCallbacks.h"
     
    7576}
    7677
    77 void DOMFileSystem::createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
     78void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassRefPtr<FileWriterCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
    7879{
    79     ASSERT(file);
     80    ASSERT(fileEntry);
    8081
    81     String platformPath = m_asyncFileSystem->virtualToPlatformPath(file->fullPath());
     82    String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
    8283
    8384    RefPtr<FileWriter> fileWriter = FileWriter::create(scriptExecutionContext());
     
    8687}
    8788
     89void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback>)
     90{
     91    String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
     92    scheduleCallback(successCallback, File::create(platformPath));
     93}
     94
    8895} // namespace
    8996
  • trunk/WebCore/fileapi/DOMFileSystem.h

    r69249 r69907  
    4141
    4242class DirectoryEntry;
     43class File;
     44class FileCallback;
    4345class FileEntry;
    4446class FileWriterCallback;
     
    5860    virtual void contextDestroyed();
    5961
    60     void createWriter(const FileEntry* file, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
     62    void createWriter(const FileEntry*, PassRefPtr<FileWriterCallback>, PassRefPtr<ErrorCallback>);
     63    void createFile(const FileEntry*, PassRefPtr<FileCallback>, PassRefPtr<ErrorCallback>);
    6164
    6265    // Schedule a callback. This should not cross threads (should be called on the same context thread).
  • trunk/WebCore/fileapi/DOMFileSystemSync.cpp

    r69249 r69907  
    3636#include "DOMFilePath.h"
    3737#include "DirectoryEntrySync.h"
     38#include "File.h"
     39#include "FileEntrySync.h"
    3840
    3941namespace WebCore {
     
    5860}
    5961
     62PassRefPtr<File> DOMFileSystemSync::createFile(const FileEntrySync* fileEntry, ExceptionCode& ec)
     63{
     64    ec = 0;
     65    String platformPath = m_asyncFileSystem->virtualToPlatformPath(fileEntry->fullPath());
     66    return File::create(platformPath);
     67}
     68
    6069}
    6170
  • trunk/WebCore/fileapi/DOMFileSystemSync.h

    r69249 r69907  
    3939
    4040class DirectoryEntrySync;
     41class File;
     42class FileEntrySync;
    4143
    4244typedef int ExceptionCode;
     
    5557    PassRefPtr<DirectoryEntrySync> root();
    5658
     59    PassRefPtr<File> createFile(const FileEntrySync*, ExceptionCode&);
     60
    5761private:
    5862    DOMFileSystemSync(const String& name, PassOwnPtr<AsyncFileSystem>);
  • trunk/WebCore/fileapi/DirectoryReaderBase.h

    r69178 r69907  
    5555
    5656    DOMFileSystemBase* m_fileSystem;
     57
     58    // This is a virtual path.
    5759    String m_fullPath;
     60
    5861    bool m_hasMoreEntries;
    5962};
  • trunk/WebCore/fileapi/EntryBase.h

    r69249 r69907  
    6868
    6969    DOMFileSystemBase* m_fileSystem;
     70
     71    // This is a virtual path.
    7072    String m_fullPath;
     73
    7174    String m_name;
    7275};
  • trunk/WebCore/fileapi/FileEntry.cpp

    r69634 r69907  
    5252}
    5353
    54 void FileEntry::file(PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback>)
     54void FileEntry::file(PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
    5555{
    56     filesystem()->scheduleCallback(successCallback, File::create(filesystem()->asyncFileSystem()->virtualToPlatformPath(m_fullPath)));
     56    filesystem()->createFile(this, successCallback, errorCallback);
    5757}
    5858
  • trunk/WebCore/fileapi/FileEntrySync.cpp

    r69178 r69907  
    3434#if ENABLE(FILE_SYSTEM)
    3535
     36#include "File.h"
     37
    3638namespace WebCore {
    3739
     
    4143}
    4244
     45PassRefPtr<File> FileEntrySync::file(ExceptionCode& ec)
     46{
     47    return filesystem()->createFile(this, ec);
     48}
     49
    4350}
    4451
  • trunk/WebCore/fileapi/FileEntrySync.h

    r69178 r69907  
    4141namespace WebCore {
    4242
     43class File;
     44
    4345class FileEntrySync : public EntrySync {
    4446public:
     
    4951
    5052    virtual bool isFile() const { return true; }
     53
     54    PassRefPtr<File> file(ExceptionCode&);
    5155
    5256private:
  • trunk/WebCore/fileapi/FileEntrySync.idl

    r69178 r69907  
    3636        NoStaticTables
    3737    ] FileEntrySync : EntrySync {
     38        File file() raises (FileException);
    3839    };
    3940}
Note: See TracChangeset for help on using the changeset viewer.