Cleanup: add a file system call which captures the file metadata at once.
authorkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2012 06:40:17 +0000 (06:40 +0000)
committerkinuko@chromium.org <kinuko@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2012 06:40:17 +0000 (06:40 +0000)
commite292f92533c4646f59ce5991b1b001cb505cc96d
treed74fae2738062a6d63a03523179718842ba8de74
parenteeb6ea76a7ca38574633acedd77e57457a2cce26
Cleanup: add a file system call which captures the file metadata at once.
https://bugs.webkit.org/show_bug.cgi?id=86995

Reviewed by David Levin.

Source/Platform:

* Platform.gypi: Added an entry for WebFileInfo.h.
* chromium/public/WebFileInfo.h: Renamed from Source/WebKit/chromium/public/WebFileInfo.h.
(WebKit::WebFileInfo::WebFileInfo):
* chromium/public/WebFileUtilities.h:
(WebKit):
(WebKit::WebFileUtilities::getFileInfo): Added.

Source/WebCore:

Current File.slice() (webkitSlice()) implementation calls two separate platform calls,
getFileSize() and getFileModificationTime() [both are defined in platform/FileSystem.h],
to capture the file metadata, but we should have a single file system call to get them at once
for two reasons: 1. save additional system call costs, and 2.  atomically obtain the file metadata.

No new tests: existing tests (http/tests/local/fileapi/* and fast/files/*) should pass.

* fileapi/File.cpp:
(WebCore::File::captureSnapshot):
* platform/FileMetadata.h:
* platform/FileSystem.h:
* platform/chromium/FileSystemChromium.cpp:
(WebCore::getFileMetadata): Added.
* platform/chromium/PlatformSupport.h:
(PlatformSupport):
* platform/gtk/FileSystemGtk.cpp:
(WebCore::getFileMetadata): Added.
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::getFileMetadata): Added.
* platform/qt/FileSystemQt.cpp:
(WebCore::getFileMetadata): Added.
* platform/win/FileSystemWin.cpp:
(WebCore::getFileSizeFromFindData):
(WebCore::getFileModificationTimeFromFindData):
(WebCore::getFileSize):
(WebCore::getFileModificationTime):
(WebCore::getFileMetadata): Added.
* platform/wince/FileSystemWinCE.cpp:
(WebCore::getFileSizeFromFileInfo):
(WebCore::getFileModificationTimeFromFileInfo):
(WebCore::getFileSize):
(WebCore::getFileModificationTime):
(WebCore::getFileMetadata): Added.
* platform/wx/FileSystemWx.cpp:
(WebCore::getFileMetadata): Added.
(WebCore):

Source/WebKit/chromium:

* src/PlatformSupport.cpp:
(WebCore::PlatformSupport::getFileMetadata):
(WebCore):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@118481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/Platform/ChangeLog
Source/Platform/Platform.gypi
Source/Platform/chromium/public/WebFileInfo.h [new file with mode: 0644]
Source/Platform/chromium/public/WebFileUtilities.h
Source/WebCore/ChangeLog
Source/WebCore/fileapi/File.cpp
Source/WebCore/platform/FileMetadata.h
Source/WebCore/platform/FileSystem.h
Source/WebCore/platform/chromium/FileSystemChromium.cpp
Source/WebCore/platform/chromium/PlatformSupport.h
Source/WebCore/platform/gtk/FileSystemGtk.cpp
Source/WebCore/platform/posix/FileSystemPOSIX.cpp
Source/WebCore/platform/qt/FileSystemQt.cpp
Source/WebCore/platform/win/FileSystemWin.cpp
Source/WebCore/platform/wince/FileSystemWinCE.cpp
Source/WebCore/platform/wx/FileSystemWx.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/public/WebFileInfo.h
Source/WebKit/chromium/src/PlatformSupport.cpp