Bug 99627 - Move ResourceRequest construction out of SubresourceLoader
Summary: Move ResourceRequest construction out of SubresourceLoader
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: Nate Chapin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-17 12:30 PDT by Nate Chapin
Modified: 2012-10-17 15:55 PDT (History)
5 users (show)

See Also:


Attachments
patch (11.34 KB, patch)
2012-10-17 12:37 PDT, Nate Chapin
no flags Details | Formatted Diff | Diff
Patch for landing (11.54 KB, patch)
2012-10-17 15:12 PDT, Nate Chapin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Chapin 2012-10-17 12:30:52 PDT
CachedResource::load() fills out a bunch of http headers.  SubresourceLoader::create() adds a bunch more.  I don't think there's a good reason for these to be set in 2 different places.  Merging them also means one less copy.

By putting everything into a helper in CachedResource, it would also be cleaner to override what headers are set for different types of resources which will be useful for adding main resources to the cache.

The downside is that it complicates CachedRawResource::canReuse().  Because a bunch of additional headers are now set on CachedResource::m_resourceRequest, we will need to be a little more careful in terms of what headers force a load from network for CachedRawResources.
Comment 1 Nate Chapin 2012-10-17 12:37:06 PDT
Created attachment 169234 [details]
patch
Comment 2 Adam Barth 2012-10-17 13:24:53 PDT
Comment on attachment 169234 [details]
patch

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

> Source/WebCore/ChangeLog:10
> +        Note that this merge requires a bit more care in CachedRawReosurce::canReuse(),

typo: CachedRawReosurce
Comment 3 Adam Barth 2012-10-17 14:39:30 PDT
Comment on attachment 169234 [details]
patch

This looks reasonable, but this code melts my brain.
Comment 4 Adam Barth 2012-10-17 14:56:02 PDT
Comment on attachment 169234 [details]
patch

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

> Source/WebCore/loader/cache/CachedRawResource.cpp:132
> +static bool shouldIgnoreHeaderForCacheReuse(AtomicString headerName)

Where did this list of headers come from?
Comment 5 Nate Chapin 2012-10-17 14:57:29 PDT
(In reply to comment #4)
> (From update of attachment 169234 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=169234&action=review
> 
> > Source/WebCore/loader/cache/CachedRawResource.cpp:132
> > +static bool shouldIgnoreHeaderForCacheReuse(AtomicString headerName)
> 
> Where did this list of headers come from?

It's the new headers that are set on CachedResource::m_resourceRequest, that are currently set directly or indirectly by SubsourceLoader::create() (the indirect ones are from FrameLoader::addExtraFieldsToRequest()).
Comment 6 Adam Barth 2012-10-17 14:58:18 PDT
Comment on attachment 169234 [details]
patch

Ok.  The list of headers seems a bit hacky...
Comment 7 Nate Chapin 2012-10-17 15:00:08 PDT
(In reply to comment #6)
> (From update of attachment 169234 [details])
> Ok.  The list of headers seems a bit hacky...

Yep, but I didn't have a better idea. :(
Comment 8 Adam Barth 2012-10-17 15:00:48 PDT
Neither do I.
Comment 9 Nate Chapin 2012-10-17 15:12:23 PDT
Created attachment 169271 [details]
Patch for landing
Comment 10 WebKit Review Bot 2012-10-17 15:55:38 PDT
Comment on attachment 169271 [details]
Patch for landing

Clearing flags on attachment: 169271

Committed r131660: <http://trac.webkit.org/changeset/131660>
Comment 11 WebKit Review Bot 2012-10-17 15:55:42 PDT
All reviewed patches have been landed.  Closing bug.