Skip to content
Permalink
Browse files
2010-10-27 Eric Uhrhane <ericu@chromium.org>
        Reviewed by David Levin.

        [Chromium] Metadata queries should return full file info, not just modification time
        https://bugs.webkit.org/show_bug.cgi?id=48098

        LayoutTests that use this functionality via WorkerAsyncFileWriter are in review.

        Build file changes to add FileMetadata.
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:

        The rest of the changes here just pass the new FileMetadata object through calls that used to take a modification time.
        * platform/FileMetadata.h: Added.
        (WebCore::FileMetadata::FileMetadata):
        * fileapi/FileSystemCallbacks.cpp:
        (WebCore::FileSystemCallbacksBase::didReadMetadata):
        (WebCore::MetadataCallbacks::didReadMetadata):
        * fileapi/FileSystemCallbacks.h:
        * platform/AsyncFileSystemCallbacks.h:
2010-10-27  Eric Uhrhane  <ericu@chromium.org>

        Reviewed by David Levin.

        [Chromium] Metadata queries should return full file info, not just modification time
        https://bugs.webkit.org/show_bug.cgi?id=48098

        * src/AssertMatchingEnums.cpp: Ensure WebFileInfo and FileMetadata use the same values for file/directory indicators.
        * src/WebFileSystemCallbacksImpl.cpp:
        (WebKit::WebFileSystemCallbacksImpl::didReadMetadata): Pass through the new information.

Canonical link: https://commits.webkit.org/61261@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70745 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Oct 28, 2010
1 parent 415b16e commit 9c68817aab036a034a2569a874ef7a5477409114
Showing 13 changed files with 131 additions and 9 deletions.
@@ -1,3 +1,28 @@
2010-10-27 Eric Uhrhane <ericu@chromium.org>

Reviewed by David Levin.

[Chromium] Metadata queries should return full file info, not just modification time
https://bugs.webkit.org/show_bug.cgi?id=48098

LayoutTests that use this functionality via WorkerAsyncFileWriter are in review.

Build file changes to add FileMetadata.
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:

The rest of the changes here just pass the new FileMetadata object through calls that used to take a modification time.
* platform/FileMetadata.h: Added.
(WebCore::FileMetadata::FileMetadata):
* fileapi/FileSystemCallbacks.cpp:
(WebCore::FileSystemCallbacksBase::didReadMetadata):
(WebCore::MetadataCallbacks::didReadMetadata):
* fileapi/FileSystemCallbacks.h:
* platform/AsyncFileSystemCallbacks.h:

2010-10-27 Chris Rogers <crogers@google.com>

Reviewed by Kenneth Russell.
@@ -2180,6 +2180,7 @@ webcore_sources += \
WebCore/platform/EventLoop.h \
WebCore/platform/FileChooser.cpp \
WebCore/platform/FileChooser.h \
WebCore/platform/FileMetadata.h \
WebCore/platform/FileStreamClient.h \
WebCore/platform/FileStream.cpp \
WebCore/platform/FileStream.h \
@@ -3292,6 +3292,7 @@
'platform/EventLoop.h',
'platform/FileChooser.cpp',
'platform/FileChooser.h',
'platform/FileMetadata.h',
'platform/FileStream.cpp',
'platform/FileStream.h',
'platform/FileStreamClient.h',
@@ -3031,7 +3031,8 @@ contains(DEFINES, ENABLE_FILE_SYSTEM=1) {
fileapi/Metadata.h \
fileapi/MetadataCallback.h \
platform/AsyncFileSystem.h \
platform/AsyncFileSystemCallbacks.h
platform/AsyncFileSystemCallbacks.h \
platform/FileMetadata.h

SOURCES += \
bindings/js/JSDirectoryEntryCustom.cpp \
@@ -24243,6 +24243,10 @@
RelativePath="..\platform\FileChooser.h"
>
</File>
<File
RelativePath="..\platform\FileMetadata.h"
>
</File>
<File
RelativePath="..\platform\FileStream.cpp"
>
@@ -948,6 +948,7 @@
4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 4614A1FD0B23A8D600446E1C /* copyCursor.png */; };
464EA2730B8A350B00A8E6E3 /* crossHairCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */; };
464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 464EA2720B8A350B00A8E6E3 /* notAllowedCursor.png */; };
4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
46BD16E30B279473001F0839 /* noneCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46BD16E20B279473001F0839 /* noneCursor.png */; };
46D4F2490AF97E810035385A /* cellCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46D4F2460AF97E810035385A /* cellCursor.png */; };
46D4F24A0AF97E810035385A /* contextMenuCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 46D4F2470AF97E810035385A /* contextMenuCursor.png */; };
@@ -7003,6 +7004,7 @@
4614A1FD0B23A8D600446E1C /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; };
464EA2710B8A350B00A8E6E3 /* crossHairCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = crossHairCursor.png; sourceTree = "<group>"; };
464EA2720B8A350B00A8E6E3 /* notAllowedCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = notAllowedCursor.png; sourceTree = "<group>"; };
4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileMetadata.h; path = platform/FileMetadata.h; sourceTree = "<group>"; };
46BD16E20B279473001F0839 /* noneCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = noneCursor.png; sourceTree = "<group>"; };
46D4F2460AF97E810035385A /* cellCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cellCursor.png; sourceTree = "<group>"; };
46D4F2470AF97E810035385A /* contextMenuCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = contextMenuCursor.png; sourceTree = "<group>"; };
@@ -14994,6 +14996,7 @@
2EDF369E122C94C8002F7D4E /* FileException.h */,
976D6C66122B8A3D001FD1F7 /* FileList.cpp */,
976D6C67122B8A3D001FD1F7 /* FileList.h */,
4689F1AE1267BAE100E8D380 /* FileMetadata.h */,
976D6C69122B8A3D001FD1F7 /* FileReader.cpp */,
976D6C6A122B8A3D001FD1F7 /* FileReader.h */,
2EDF369A122C94B4002F7D4E /* FileReaderSync.cpp */,
@@ -21158,6 +21161,7 @@
93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */,
E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */,
4FA3B90B125CD12200300BAD /* InspectorState.h in Headers */,
9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */,
F7A034C4126BF6BE007DC19E /* FontOrientation.h in Headers */,
@@ -45,6 +45,7 @@
#include "ErrorCallback.h"
#include "FileEntry.h"
#include "FileError.h"
#include "FileMetadata.h"
#include "FileSystemCallback.h"
#include "FileWriter.h"
#include "FileWriterCallback.h"
@@ -76,7 +77,7 @@ void FileSystemCallbacksBase::didOpenFileSystem(const String&, PassOwnPtr<AsyncF
ASSERT_NOT_REACHED();
}

void FileSystemCallbacksBase::didReadMetadata(double)
void FileSystemCallbacksBase::didReadMetadata(const FileMetadata&)
{
// Each subclass must implement an appropriate one.
ASSERT_NOT_REACHED();
@@ -204,10 +205,10 @@ MetadataCallbacks::MetadataCallbacks(PassRefPtr<MetadataCallback> successCallbac
{
}

void MetadataCallbacks::didReadMetadata(double modificationTime)
void MetadataCallbacks::didReadMetadata(const FileMetadata& metadata)
{
if (m_successCallback)
m_successCallback->handleEvent(Metadata::create(modificationTime).get());
m_successCallback->handleEvent(Metadata::create(metadata.modificationTime).get());
m_successCallback.clear();
}

@@ -47,6 +47,7 @@ class ErrorCallback;
class EntriesCallback;
class EntryArray;
class EntryCallback;
class FileMetadata;
class FileSystemCallback;
class FileWriter;
class FileWriterCallback;
@@ -65,7 +66,7 @@ class FileSystemCallbacksBase : public AsyncFileSystemCallbacks {
virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>);

// For MetadataCallbacks.
virtual void didReadMetadata(double modificationTime);
virtual void didReadMetadata(const FileMetadata&);

// For EntriesCallbacks. didReadDirectoryEntry is called each time the API reads an entry, and didReadDirectoryDone is called when a chunk of entries have been read (i.e. good time to call back to the application). If hasMore is true there can be more chunks.
virtual void didReadDirectoryEntry(const String& name, bool isDirectory);
@@ -125,7 +126,7 @@ class FileSystemCallbacks : public FileSystemCallbacksBase {
class MetadataCallbacks : public FileSystemCallbacksBase {
public:
static PassOwnPtr<MetadataCallbacks> create(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>);
virtual void didReadMetadata(double modificationTime);
virtual void didReadMetadata(const FileMetadata&);

private:
MetadataCallbacks(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>);
@@ -39,6 +39,7 @@ namespace WebCore {

class AsyncFileSystem;
class AsyncFileWriter;
class FileMetadata;

class AsyncFileSystemCallbacks : public Noncopyable {
public:
@@ -49,7 +50,7 @@ class AsyncFileSystemCallbacks : public Noncopyable {
virtual void didOpenFileSystem(const String& name, PassOwnPtr<AsyncFileSystem>) = 0;

// Called when a file metadata is read successfully.
virtual void didReadMetadata(double modificationTime) = 0;
virtual void didReadMetadata(const FileMetadata&) = 0;

// Called when a directory entry is read.
virtual void didReadDirectoryEntry(const String& name, bool isDirectory) = 0;
@@ -0,0 +1,62 @@
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FileMetadata_h
#define FileMetadata_h

#if ENABLE(FILE_SYSTEM)

namespace WebCore {

struct FileMetadata {
// The last modification time of the file, in seconds.
// The value 0.0 means that the time is not set.
double modificationTime;

// The length of the file in bytes.
// The value -1 means that the length is not set.
long long length;

enum Type {
TypeUnknown = 0,
TypeFile,
TypeDirectory
};

Type type;

FileMetadata() : modificationTime(0.0), length(-1), type(TypeUnknown) { }
};

} // namespace WebCore

#endif // ENABLE(FILE_SYSTEM)

#endif // FileMetadata_h
@@ -1,3 +1,14 @@
2010-10-27 Eric Uhrhane <ericu@chromium.org>

Reviewed by David Levin.

[Chromium] Metadata queries should return full file info, not just modification time
https://bugs.webkit.org/show_bug.cgi?id=48098

* src/AssertMatchingEnums.cpp: Ensure WebFileInfo and FileMetadata use the same values for file/directory indicators.
* src/WebFileSystemCallbacksImpl.cpp:
(WebKit::WebFileSystemCallbacksImpl::didReadMetadata): Pass through the new information.

2010-10-27 Kenneth Russell <kbr@google.com>

Reviewed by Dimitri Glazkov.
@@ -38,6 +38,7 @@
#include "AsyncFileSystem.h"
#include "EditorInsertAction.h"
#include "FileError.h"
#include "FileMetadata.h"
#include "FontDescription.h"
#include "FontSmoothingMode.h"
#include "HTMLInputElement.h"
@@ -58,6 +59,7 @@
#include "WebCursorInfo.h"
#include "WebEditingAction.h"
#include "WebFileError.h"
#include "WebFileInfo.h"
#include "WebFileSystem.h"
#include "WebFontDescription.h"
#include "WebIDBKey.h"
@@ -363,6 +365,9 @@ COMPILE_ASSERT_MATCHING_ENUM(WebIDBKey::NumberType, IDBKey::NumberType);
#if ENABLE(FILE_SYSTEM)
COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary);
COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent);
COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown);
COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile);
COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeDirectory, FileMetadata::TypeDirectory);
#endif

COMPILE_ASSERT_MATCHING_ENUM(WebFileErrorNotFound, FileError::NOT_FOUND_ERR);
@@ -34,6 +34,7 @@

#include "AsyncFileSystemCallbacks.h"
#include "AsyncFileSystemChromium.h"
#include "FileMetadata.h"
#include "ScriptExecutionContext.h"
#include "WebFileSystemEntry.h"
#include "WebFileInfo.h"
@@ -63,9 +64,13 @@ void WebFileSystemCallbacksImpl::didSucceed()
delete this;
}

void WebFileSystemCallbacksImpl::didReadMetadata(const WebFileInfo& info)
void WebFileSystemCallbacksImpl::didReadMetadata(const WebFileInfo& webFileInfo)
{
m_callbacks->didReadMetadata(info.modificationTime);
FileMetadata fileMetadata;
fileMetadata.modificationTime = webFileInfo.modificationTime;
fileMetadata.length = webFileInfo.length;
fileMetadata.type = static_cast<FileMetadata::Type>(webFileInfo.type);
m_callbacks->didReadMetadata(fileMetadata);
delete this;
}

0 comments on commit 9c68817

Please sign in to comment.