WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
86995
Cleanup: add a file system call which captures the file metadata at once.
https://bugs.webkit.org/show_bug.cgi?id=86995
Summary
Cleanup: add a file system call which captures the file metadata at once.
Kinuko Yasuda
Reported
2012-05-21 01:21:16 PDT
Cleanup: add a file system call which captures the file metadata at once. 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.
Attachments
Patch
(19.67 KB, patch)
2012-05-21 01:38 PDT
,
Kinuko Yasuda
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Patch
(19.83 KB, patch)
2012-05-21 02:37 PDT
,
Kinuko Yasuda
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Patch
(20.04 KB, patch)
2012-05-21 04:06 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(20.95 KB, patch)
2012-05-21 05:05 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(20.97 KB, patch)
2012-05-21 05:09 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(26.35 KB, patch)
2012-05-21 10:55 PDT
,
Kinuko Yasuda
no flags
Details
Formatted Diff
Diff
Patch
(26.64 KB, patch)
2012-05-24 02:16 PDT
,
Kinuko Yasuda
levin
: review+
levin
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Kinuko Yasuda
Comment 1
2012-05-21 01:38:04 PDT
Created
attachment 142967
[details]
Patch
WebKit Review Bot
Comment 2
2012-05-21 01:41:50 PDT
Please wait for approval from
abarth@webkit.org
,
dglazkov@chromium.org
,
fishd@chromium.org
,
jamesr@chromium.org
or
tkent@chromium.org
before submitting, as this patch contains changes to the Chromium public API. See also
https://trac.webkit.org/wiki/ChromiumWebKitAPI
.
Build Bot
Comment 3
2012-05-21 02:06:42 PDT
Comment on
attachment 142967
[details]
Patch
Attachment 142967
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12741192
Kinuko Yasuda
Comment 4
2012-05-21 02:37:45 PDT
Created
attachment 142975
[details]
Patch
Build Bot
Comment 5
2012-05-21 03:01:55 PDT
Comment on
attachment 142975
[details]
Patch
Attachment 142975
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12744151
Kinuko Yasuda
Comment 6
2012-05-21 04:06:42 PDT
Created
attachment 142989
[details]
Patch
Build Bot
Comment 7
2012-05-21 04:27:52 PDT
Comment on
attachment 142989
[details]
Patch
Attachment 142989
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12736521
Kinuko Yasuda
Comment 8
2012-05-21 05:05:07 PDT
Created
attachment 143003
[details]
Patch
Kinuko Yasuda
Comment 9
2012-05-21 05:09:47 PDT
Created
attachment 143005
[details]
Patch
Adam Barth
Comment 10
2012-05-21 08:56:44 PDT
Comment on
attachment 143005
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=143005&action=review
> Source/Platform/chromium/public/WebFileUtilities.h:44 > +struct WebFileInfo;
Looks like you forgot to svn add WebFileInfo.h
> Source/Platform/chromium/public/WebFileUtilities.h:57 > virtual bool getFileSize(const WebString& path, long long& result) { return false; } > virtual bool getFileModificationTime(const WebString& path, double& result) { return false; }
Should we mark these as deprecated and plan to delete them?
Adam Barth
Comment 11
2012-05-21 08:58:05 PDT
Actually, looks like it does exist at
http://trac.webkit.org/browser/trunk/Source/WebKit/chromium/public/WebFileInfo.h
. Can you move it into Platform/chromium/public ? The Source/Platform shouldn't refer to things in Source/WebKit
Kinuko Yasuda
Comment 12
2012-05-21 10:55:31 PDT
Created
attachment 143059
[details]
Patch
Kinuko Yasuda
Comment 13
2012-05-21 10:57:06 PDT
Comment on
attachment 143005
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=143005&action=review
>> Source/Platform/chromium/public/WebFileUtilities.h:44 >> +struct WebFileInfo; > > Looks like you forgot to svn add WebFileInfo.h
Moved Source/WebKit/chromium/public/WebFileInfo.h into Platform/chromium/public.
>> Source/Platform/chromium/public/WebFileUtilities.h:57 >> virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } > > Should we mark these as deprecated and plan to delete them?
Sounds good, added a comment.
Kinuko Yasuda
Comment 14
2012-05-21 10:57:12 PDT
Comment on
attachment 143005
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=143005&action=review
>> Source/Platform/chromium/public/WebFileUtilities.h:44 >> +struct WebFileInfo; > > Looks like you forgot to svn add WebFileInfo.h
Moved Source/WebKit/chromium/public/WebFileInfo.h into Platform/chromium/public.
>> Source/Platform/chromium/public/WebFileUtilities.h:57 >> virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } > > Should we mark these as deprecated and plan to delete them?
Sounds good, added a comment.
Adam Barth
Comment 15
2012-05-21 11:01:22 PDT
Comment on
attachment 143059
[details]
Patch WebKit API changes LGTM
Kinuko Yasuda
Comment 16
2012-05-22 22:45:45 PDT
This isn't intended to change existing behavior but is intended to remove FIXME's in File and cleanup platform APIs. (I also would like to use the new platform API for other purpose) Jian, David could either of you take a look at the patch? Thanks!
David Levin
Comment 17
2012-05-23 14:37:39 PDT
Comment on
attachment 143059
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=143059&action=review
r- see comments. I would do it in a dropdown but I have
https://code.google.com/p/chromium/issues/detail?id=129444
to contend with :(.
> Source/WebCore/platform/posix/FileSystemPOSIX.cpp:199 > + return true;
It feels like this code should be exactly like the code you added in FileSystemGtk.cpp (or visa versa) except for the g_stat vs stat. Why are there are other differences?
> Source/WebCore/platform/qt/FileSystemQt.cpp:80 > + result.modificationTime = info.lastModified().toTime_t();
What data is being access if the file doesn't exist? It feels sketchy to do this if !info.exists().
> Source/WebCore/platform/win/FileSystemWin.cpp:79 > + return true;
Why return a bool at all if it always returns true?
> Source/WebCore/platform/wince/FileSystemWinCE.cpp:72 > +static void getFileSizeFromFileInfo(const BY_HANDLE_FILE_INFORMATION& fileInfo, long long& result)
result isn't very descriptive of what the variable contains.
> Source/WebCore/platform/wince/FileSystemWinCE.cpp:84 > + result = t.QuadPart * 0.0000001 - 11644473600.0;
ditto re result (and in the other changes in this file).
> Source/WebCore/platform/wx/FileSystemWx.cpp:89 > +bool getFileMetadata(const String& path, FileMetadata& t)
avoid abbreviations "t"
> Source/WebKit/chromium/src/PlatformSupport.cpp:340 > + result.type = static_cast<FileMetadata::Type>(webFileInfo.type);
Is there already a function to do this conversion (near some place with COMPILE_ASSERTS to verify that the values are the same)?
Kinuko Yasuda
Comment 18
2012-05-24 02:16:53 PDT
Created
attachment 143768
[details]
Patch
Kinuko Yasuda
Comment 19
2012-05-24 02:20:40 PDT
Comment on
attachment 143059
[details]
Patch Thanks!! Updated the patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=143059&action=review
>> Source/WebCore/platform/posix/FileSystemPOSIX.cpp:199 >> + return true; > > It feels like this code should be exactly like the code you added in FileSystemGtk.cpp (or visa versa) except for the g_stat vs stat. Why are there are other differences?
Basically I followed other code in the same file (e.g. posix's getFileMetadata() is implemented after posix's getFileSize and getFileModificationTime), and coding convention / preferences in each platform looks slightly different.
>> Source/WebCore/platform/qt/FileSystemQt.cpp:80 >> + result.modificationTime = info.lastModified().toTime_t(); > > What data is being access if the file doesn't exist? > > It feels sketchy to do this if !info.exists().
Good catch, fixed to exit earlier.
>> Source/WebCore/platform/win/FileSystemWin.cpp:79 >> + return true; > > Why return a bool at all if it always returns true?
Fixed.
>> Source/WebCore/platform/wince/FileSystemWinCE.cpp:72 >> +static void getFileSizeFromFileInfo(const BY_HANDLE_FILE_INFORMATION& fileInfo, long long& result) > > result isn't very descriptive of what the variable contains.
Fixed.
>> Source/WebCore/platform/wince/FileSystemWinCE.cpp:84 >> + result = t.QuadPart * 0.0000001 - 11644473600.0; > > ditto re result (and in the other changes in this file).
Fixed.
>> Source/WebCore/platform/wx/FileSystemWx.cpp:89 >> +bool getFileMetadata(const String& path, FileMetadata& t) > > avoid abbreviations "t"
Fixed.
>> Source/WebKit/chromium/src/PlatformSupport.cpp:340 >> + result.type = static_cast<FileMetadata::Type>(webFileInfo.type); > > Is there already a function to do this conversion (near some place with COMPILE_ASSERTS to verify that the values are the same)?
Yes, we have assertions in WebKit/chromium/src/AssertMatchingEnums.cpp.
David Levin
Comment 20
2012-05-24 11:37:20 PDT
Comment on
attachment 143768
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=143768&action=review
Only two comments. Feel free to address and submit.
> Source/WebCore/platform/FileMetadata.h:57 > +#endif // ENABLE(FILE_SYSTEM)
The end comment for the if isn't necessary and doesn't seem very useful for such a short area.
> Source/WebCore/platform/chromium/FileSystemChromium.cpp:61 > +bool getFileMetadata(const String& path, FileMetadata& result)
result isn't very descriptive.
> Source/WebCore/platform/chromium/FileSystemChromium.cpp:70 > + result.modificationTime = modificationTime;
Why doesn't this set type?
Kinuko Yasuda
Comment 21
2012-05-24 23:33:40 PDT
Thanks, will address them and submit. (In reply to
comment #20
)
> (From update of
attachment 143768
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=143768&action=review
> > Only two comments. Feel free to address and submit. > > > Source/WebCore/platform/FileMetadata.h:57 > > +#endif // ENABLE(FILE_SYSTEM) > > The end comment for the if isn't necessary and doesn't seem very useful for such a short area.
Will remove it.
> > Source/WebCore/platform/chromium/FileSystemChromium.cpp:61 > > +bool getFileMetadata(const String& path, FileMetadata& result) > > result isn't very descriptive.
Will fix.
> > Source/WebCore/platform/chromium/FileSystemChromium.cpp:70 > > + result.modificationTime = modificationTime; > > Why doesn't this set type?
The type info isn't available until the chromium port implementation is landed (which will come shortly). For now I I'll add more specific FIXME comment.
Kinuko Yasuda
Comment 22
2012-05-24 23:40:38 PDT
Committed
r118481
: <
http://trac.webkit.org/changeset/118481
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug