Bug 88512 - Move Quota related code out of DOMWindow and into the quota/ folder
Summary: Move Quota related code out of DOMWindow and into the quota/ folder
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kinuko Yasuda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-07 01:46 PDT by Kinuko Yasuda
Modified: 2012-06-10 23:14 PDT (History)
9 users (show)

See Also:


Attachments
Patch (128.91 KB, patch)
2012-06-07 03:32 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Patch (126.84 KB, patch)
2012-06-07 03:49 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-02 (619.00 KB, application/zip)
2012-06-07 08:42 PDT, WebKit Review Bot
no flags Details
Patch (128.62 KB, patch)
2012-06-08 01:21 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Patch (129.74 KB, patch)
2012-06-08 01:41 PDT, Kinuko Yasuda
abarth: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kinuko Yasuda 2012-06-07 01:46:58 PDT
Move Quota related code out of DOMWindow and into the quota/ folder.

(Separated out from bug 88396)
Comment 1 Kinuko Yasuda 2012-06-07 03:32:13 PDT
Created attachment 146245 [details]
Patch
Comment 2 Kinuko Yasuda 2012-06-07 03:49:13 PDT
Created attachment 146246 [details]
Patch
Comment 3 WebKit Review Bot 2012-06-07 08:42:47 PDT
Comment on attachment 146246 [details]
Patch

Attachment 146246 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12921196

New failing tests:
fast/table/multiple-captions-display.xhtml
Comment 4 WebKit Review Bot 2012-06-07 08:42:51 PDT
Created attachment 146295 [details]
Archive of layout-test-results from ec2-cr-linux-02

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-02  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 5 Kinuko Yasuda 2012-06-07 09:09:49 PDT
(In reply to comment #3)
> (From update of attachment 146246 [details])
> Attachment 146246 [details] did not pass chromium-ews (chromium-xvfb):
> Output: http://queues.webkit.org/results/12921196
> 
> New failing tests:
> fast/table/multiple-captions-display.xhtml

This test failure is unrelated to the change.
Comment 6 Adam Barth 2012-06-07 16:33:15 PDT
Comment on attachment 146246 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=146246&action=review

The main thing to address before landing is caching the StorageInfo object.  I'm happy to take a look at an updated patch if you're unsure about the Supplement pattern.

> Source/WebCore/Modules/quota/DOMWindowStorageInfo.cpp:45
> +    return StorageInfo::create();

Do we really want to return a new one each time?  I would have thought we'd want to cache it so that window.webkitStorageInfo === window.webkitStorageInfo

> Source/WebCore/Modules/quota/DOMWindowStorageInfo.h:43
> +class DOMWindowStorageInfo {

DOMWindowStorageInfo -> DOMWindowQuota (we're trying to have these names match the module name)

> Source/WebCore/Modules/quota/StorageInfo.cpp:64
> +#if !PLATFORM(CHROMIUM)
> +void StorageInfo::queryUsageAndQuota(ScriptExecutionContext*, int, PassRefPtr<StorageInfoUsageCallback>, PassRefPtr<StorageInfoErrorCallback>)
> +{
> +    notImplemented();
> +}
> +
> +void StorageInfo::requestQuota(ScriptExecutionContext*, int, unsigned long long, PassRefPtr<StorageInfoQuotaCallback>, PassRefPtr<StorageInfoErrorCallback>)
> +{
> +    notImplemented();
> +}
> +#endif

Is there a reason to turn ENABLE(QUOTA) on without implementing these functions?  If so, we do this is with a StorageInfoNone.cpp that folks can link in if they don't implement the feature.

> Source/WebCore/Modules/quota/StorageInfo.idl:30
> +        JSGenerateToNativeObject

Why is this needed?

> Source/WebCore/page/DOMWindow.cpp:-1946
> -StorageInfo* DOMWindow::webkitStorageInfo() const
> -{
> -    if (!isCurrentlyDisplayedInFrame())
> -        return 0;
> -    if (!m_storageInfo)
> -        m_storageInfo = StorageInfo::create();
> -    return m_storageInfo.get();
> -}

Ah, so it used to be cached.  We'll need to implement something like this logic in DOMWindowQuota.  If you look at some of the other modules, you can see how to do this with the Supplement pattern.

> Source/WebCore/storage/StorageInfo.cpp:-54
> -#if !PLATFORM(CHROMIUM)

Ah, I see this already existed.  It's fine to keep this in this patch since you're just moving the file, but consider a followup patch that removes the PLATFORM(CHROMIUM) ifdefs.

> Source/WebCore/storage/StorageInfo.idl:-30
> -        JSGenerateToNativeObject

Ah, this is here too.  Ok.  I wonder if its needed...
Comment 7 Kinuko Yasuda 2012-06-08 01:21:06 PDT
Created attachment 146503 [details]
Patch
Comment 8 Kinuko Yasuda 2012-06-08 01:31:30 PDT
Comment on attachment 146246 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=146246&action=review

>> Source/WebCore/Modules/quota/DOMWindowStorageInfo.cpp:45
>> +    return StorageInfo::create();
> 
> Do we really want to return a new one each time?  I would have thought we'd want to cache it so that window.webkitStorageInfo === window.webkitStorageInfo

Done.

>> Source/WebCore/Modules/quota/DOMWindowStorageInfo.h:43
>> +class DOMWindowStorageInfo {
> 
> DOMWindowStorageInfo -> DOMWindowQuota (we're trying to have these names match the module name)

Done.

>> Source/WebCore/Modules/quota/StorageInfo.cpp:64
>> +#endif
> 
> Is there a reason to turn ENABLE(QUOTA) on without implementing these functions?  If so, we do this is with a StorageInfoNone.cpp that folks can link in if they don't implement the feature.

Good point, I don't think we need this actually.  Just dropped them.

>> Source/WebCore/Modules/quota/StorageInfo.idl:30
>> +        JSGenerateToNativeObject
> 
> Why is this needed?

Hmm.. doesn't look we need it.  Removed.
Comment 9 Kinuko Yasuda 2012-06-08 01:41:33 PDT
Created attachment 146506 [details]
Patch
Comment 10 Kinuko Yasuda 2012-06-08 02:58:52 PDT
(In reply to comment #6)
> (From update of attachment 146246 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=146246&action=review
> 
> The main thing to address before landing is caching the StorageInfo object.  I'm happy to take a look at an updated patch if you're unsure about the Supplement pattern.

Updated the patch to use the Supplement pattern to cache the StorageInfo object.  Adam, can you take one more quick look?  Thanks!
Comment 11 Adam Barth 2012-06-08 11:20:12 PDT
Comment on attachment 146506 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=146506&action=review

Looks great.  Thanks!

> Source/WebCore/Modules/quota/DOMWindowQuota.cpp:51
> +// static

We usually skip these sorts of comments.
Comment 12 Kinuko Yasuda 2012-06-10 23:14:51 PDT
Committed r119954: <http://trac.webkit.org/changeset/119954>