NEW 45486
Pass CachedMetadata on ResourceResponse instead of in a separate call
https://bugs.webkit.org/show_bug.cgi?id=45486
Summary Pass CachedMetadata on ResourceResponse instead of in a separate call
Tony Gentilcore
Reported 2010-09-09 12:47:39 PDT
Pass CachedMetadata on ResourceResponse instead of in a separate call
Attachments
Patch (29.67 KB, patch)
2010-09-09 13:09 PDT, Tony Gentilcore
no flags
Build fix (30.23 KB, patch)
2010-09-09 16:48 PDT, Tony Gentilcore
no flags
Patch (27.71 KB, patch)
2010-09-22 11:31 PDT, Tony Gentilcore
ap: review-
Tony Gentilcore
Comment 1 2010-09-09 13:09:31 PDT
Tony Gentilcore
Comment 2 2010-09-09 13:10:52 PDT
You were right, this is cleaner and should be more efficient.
Early Warning System Bot
Comment 3 2010-09-09 13:36:31 PDT
Eric Seidel (no email)
Comment 4 2010-09-09 15:41:52 PDT
WebKit Review Bot
Comment 5 2010-09-09 16:19:18 PDT
Tony Gentilcore
Comment 6 2010-09-09 16:48:59 PDT
Created attachment 67118 [details] Build fix
Eric Seidel (no email)
Comment 7 2010-09-09 17:39:19 PDT
Tony Gentilcore
Comment 8 2010-09-14 14:56:32 PDT
*** Bug 45483 has been marked as a duplicate of this bug. ***
Darin Fisher (:fishd, Google)
Comment 9 2010-09-14 22:29:44 PDT
Comment on attachment 67118 [details] Build fix View in context: https://bugs.webkit.org/attachment.cgi?id=67118&action=prettypatch > WebCore/loader/CachedMetadata.h:64 > + RefPtr<CachedMetadata> cachedMetadata = create(dataTypeID(), data(), size()); don't create functions normally return PassRefPtr? why bother with the intermediate cachedMetadata variable? > WebCore/loader/CachedMetadata.h:68 > + bool operator==(const CachedMetadata& other) const not that it really matters here, but normally it is better to define operator== and operator!= at global scope so that type coercion works properly. as member functions, only the right-hand-side argument can be coerced. > WebKit/chromium/public/WebCachedMetadata.h:41 > +class WebCachedMetadata { would it make sense to use WebData in place of defining this new class? note: WebData can be converted to a RefPtr<SharedBuffer> without any cost. i ask because this class just looks like a wrapper for an array of bytes. that's what WebData is. otherwise, looks great to me!
Tony Gentilcore
Comment 10 2010-09-22 11:31:25 PDT
Eric Seidel (no email)
Comment 11 2010-09-22 12:45:52 PDT
Adam Barth
Comment 12 2010-09-26 22:19:35 PDT
Comment on attachment 68403 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=68403&action=review > WebCore/loader/CachedMetadata.h:132 > + return a.serialize() == b.serialize(); Woah, that looks expensive.
Eric Seidel (no email)
Comment 13 2010-12-14 01:57:18 PST
What's the status on this patch, Tony?
Tony Gentilcore
Comment 14 2010-12-14 09:25:11 PST
(In reply to comment #13) > What's the status on this patch, Tony? Thanks for the ping. I'm missing a file needed a on mac. I'll get it synced up and landed this week.
Alexey Proskuryakov
Comment 15 2010-12-14 11:02:15 PST
Wait, why is this a good thing? This seems to be going in a wrong direction of adding non-network data to network classes.
Adam Barth
Comment 16 2010-12-14 12:22:24 PST
(In reply to comment #15) > Wait, why is this a good thing? This seems to be going in a wrong direction of adding non-network data to network classes. The CachedMetadata is meta data about the response that we'd like to store in the HTTP cache. For example, it might contain a post-parsing representation of a JavaScript script so we don't have to parse it again if we get a cache hit.
Alexey Proskuryakov
Comment 17 2010-12-14 12:42:54 PST
But that's exactly what CachedScript is doing.
Adam Barth
Comment 18 2010-12-14 14:05:11 PST
(In reply to comment #17) > But that's exactly what CachedScript is doing. Right, but we want to store it on disk.
Alexey Proskuryakov
Comment 19 2010-12-14 14:35:53 PST
I've been told that we want to store CachedResource to disk, in fact. I think that moving CachedResource behaviors down to ResourceRequest/Response is going in a wrong direction, and conflicts with work being done in CachedResource land.
Adam Barth
Comment 20 2010-12-14 14:40:23 PST
> I've been told that we want to store CachedResource to disk, in fact. I think that moving CachedResource behaviors down to ResourceRequest/Response is going in a wrong direction, and conflicts with work being done in CachedResource land. The approach in this work is to integrate the disk storage with the HTTP disk cache so that the two objects can be managed together. For example, when the we evict the resource from the HTTP disk cache, we want to evict the metadata too. If we were to re-implement disk storage at the MemoryCache layer, we'd just be re-inventing all the mechanisms of the HTTP disk cache.
Alexey Proskuryakov
Comment 21 2010-12-14 15:00:36 PST
Comment on attachment 68403 [details] Patch This seems to need deeper discussion. I've already Cc'ed Antti; marking r- to reflect that discussion is needed.
Tony Gentilcore
Comment 22 2010-12-14 15:55:51 PST
I can explain some background. V8's PreCompile() method generates some metadata that makes future calls to Compile() faster (it is basically just the offset of each brace). On a particular collection of web pages, we found that about 7% of the overall page load time in chromium is spent preparsing JavaScript. So to speed up future loads we store this as metadata on CachedResource. It is stored as a generic bucket of bytes so that other CachedResource types may use this mechanism as well. But just saving it in the memory cache is of limited usefulness. To increase the number of cases where this metadata is available, we notify the embedding application via didReceiveCachedMetadata() so that it may save it into its disk cache. However, for chromium that ends up resulting in two IPC calls: didReceiveResponse and didReceiveCachedMetadata. The goal of this patch was to merge those into a single IPC by simply making the metadata available on the ResourceResponse which is already passed to didReceiveResponse. I'm completely open to other ways to accomplish the same thing. Do you have time to describe the changes that are happening regarding saving CachedResources to disk?
Note You need to log in before you can comment on or make changes to this bug.