Bug 63849 - WebKit2: Need callbacks for when a page goes in and out of the WebCore cache
Summary: WebKit2: Need callbacks for when a page goes in and out of the WebCore cache
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jessie Berlin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-07-01 14:30 PDT by Jessie Berlin
Modified: 2012-10-11 16:37 PDT (History)
9 users (show)

See Also:


Attachments
Patch (53.15 KB, patch)
2011-07-01 16:25 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff
Patch (Take 2) (53.35 KB, patch)
2011-07-03 14:55 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff
Patch (using BundleNodeHandles instead of document ids) (54.88 KB, patch)
2011-07-05 12:13 PDT, Jessie Berlin
gyuyoung.kim: commit-queue-
Details | Formatted Diff | Diff
Patch (first build-fix attempt) (55.09 KB, patch)
2011-07-05 12:32 PDT, Jessie Berlin
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jessie Berlin 2011-07-01 14:30:25 PDT
<rdar://problem/8108540>
Comment 1 Jessie Berlin 2011-07-01 16:25:56 PDT
Created attachment 99536 [details]
Patch
Comment 2 Andy Estes 2011-07-01 16:44:36 PDT
Comment on attachment 99536 [details]
Patch

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

> Source/WebCore/history/CachedFrame.cpp:249
> +    m_view->frame()->loader()->client()->didRemoveFromPageCache(m_document->docID());

It seems odd that the client gets a callback called DidRemoveFromPageCache before the actual work of removing the cached frame is completed.
Comment 3 Jessie Berlin 2011-07-01 17:14:16 PDT
(In reply to comment #2)
> (From update of attachment 99536 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=99536&action=review
> 
> > Source/WebCore/history/CachedFrame.cpp:249
> > +    m_view->frame()->loader()->client()->didRemoveFromPageCache(m_document->docID());
> 
> It seems odd that the client gets a callback called DidRemoveFromPageCache before the actual work of removing the cached frame is completed.

Yes, I will move the call down after clear() has been called on the CachedFrame.

Originally, I was worried that would result in me using an already destroyed frame object. However, I have tested and also verified to myself that this is not the case.

Thanks for your feedback!
Comment 4 Jessie Berlin 2011-07-03 14:55:14 PDT
Created attachment 99581 [details]
Patch (Take 2)
Comment 5 Sam Weinig 2011-07-03 18:27:00 PDT
Comment on attachment 99581 [details]
Patch (Take 2)

I don't understand why sending the documentID is better than sending the Document itself.  That would be the usual way to do this.
Comment 6 Jessie Berlin 2011-07-04 13:29:08 PDT
(In reply to comment #5)
> (From update of attachment 99581 [details])
> I don't understand why sending the documentID is better than sending the Document itself.  That would be the usual way to do this.

Should I create a new WK2 type for Document, just to have something to pass around (with no need for attributes or methods on it)?
Comment 7 Sam Weinig 2011-07-04 23:37:28 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > (From update of attachment 99581 [details] [details])
> > I don't understand why sending the documentID is better than sending the Document itself.  That would be the usual way to do this.
> 
> Should I create a new WK2 type for Document, just to have something to pass around (with no need for attributes or methods on it)?

Since a Document is a Node, you can use BundleNodeHandleRef.
Comment 8 Jessie Berlin 2011-07-05 12:13:21 PDT
Created attachment 99734 [details]
Patch (using BundleNodeHandles instead of document ids)
Comment 9 Gyuyoung Kim 2011-07-05 12:18:01 PDT
Comment on attachment 99734 [details]
Patch (using BundleNodeHandles instead of document ids)

Attachment 99734 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/8983724
Comment 10 WebKit Review Bot 2011-07-05 12:18:19 PDT
Comment on attachment 99734 [details]
Patch (using BundleNodeHandles instead of document ids)

Attachment 99734 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/8987425
Comment 11 Early Warning System Bot 2011-07-05 12:22:10 PDT
Comment on attachment 99734 [details]
Patch (using BundleNodeHandles instead of document ids)

Attachment 99734 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/8988431
Comment 12 Collabora GTK+ EWS bot 2011-07-05 12:27:50 PDT
Comment on attachment 99734 [details]
Patch (using BundleNodeHandles instead of document ids)

Attachment 99734 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/8986504
Comment 13 WebKit Review Bot 2011-07-05 12:31:56 PDT
Comment on attachment 99734 [details]
Patch (using BundleNodeHandles instead of document ids)

Attachment 99734 [details] did not pass cr-mac-ews (chromium):
Output: http://queues.webkit.org/results/8983727
Comment 14 Jessie Berlin 2011-07-05 12:32:00 PDT
Created attachment 99736 [details]
Patch (first build-fix attempt)
Comment 15 Adam Roben (:aroben) 2011-07-06 06:53:24 PDT
Comment on attachment 99736 [details]
Patch (first build-fix attempt)

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

> Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:104
> +typedef void (*WKBundlePageDidSaveToPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> +typedef void (*WKBundlePageDidRestoreFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> +typedef void (*WKBundlePageDidRemoveFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);

"PageCache" seems like the wrong term here. Based on the API, this looks like a document cache, not a page cache. I know "page cache" is the term we use throughout WebCore, but perhaps we should not expose that name as API?
Comment 16 Sam Weinig 2011-07-06 08:24:16 PDT
(In reply to comment #15)
> (From update of attachment 99736 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=99736&action=review
> 
> > Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:104
> > +typedef void (*WKBundlePageDidSaveToPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > +typedef void (*WKBundlePageDidRestoreFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > +typedef void (*WKBundlePageDidRemoveFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> 
> "PageCache" seems like the wrong term here. Based on the API, this looks like a document cache, not a page cache. I know "page cache" is the term we use throughout WebCore, but perhaps we should not expose that name as API?

For now, I think we should stick with PageCache as it is the familiar term.
Comment 17 Adam Roben (:aroben) 2011-07-06 08:31:31 PDT
(In reply to comment #16)
> (In reply to comment #15)
> > (From update of attachment 99736 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=99736&action=review
> > 
> > > Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:104
> > > +typedef void (*WKBundlePageDidSaveToPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > > +typedef void (*WKBundlePageDidRestoreFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > > +typedef void (*WKBundlePageDidRemoveFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > 
> > "PageCache" seems like the wrong term here. Based on the API, this looks like a document cache, not a page cache. I know "page cache" is the term we use throughout WebCore, but perhaps we should not expose that name as API?
> 
> For now, I think we should stick with PageCache as it is the familiar term.

Familiar to whom? Have we ever exposed this concept in the WebKit API before?
Comment 18 Adam Roben (:aroben) 2011-07-06 08:32:49 PDT
(In reply to comment #17)
> Have we ever exposed this concept in the WebKit API before?

I guess we have, in WebKit1.
Comment 19 Adam Roben (:aroben) 2011-07-06 08:33:12 PDT
Still, what better time to give it a better name than when designing a new API from scratch?
Comment 20 Brady Eidson 2011-07-06 10:32:03 PDT
(In reply to comment #15)
> (From update of attachment 99736 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=99736&action=review
> 
> > Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:104
> > +typedef void (*WKBundlePageDidSaveToPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > +typedef void (*WKBundlePageDidRestoreFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> > +typedef void (*WKBundlePageDidRemoveFromPageCacheCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNodeHandleRef document, const void *clientInfo);
> 
> "PageCache" seems like the wrong term here. Based on the API, this looks like a document cache, not a page cache. I know "page cache" is the term we use throughout WebCore, but perhaps we should not expose that name as API?

The API could perhaps be "didSaveDocumentToPageCache", "didRestoreDocumentFromPageCache", and "didRemoveDocumentFromPageCache"

But it is *not* a document cache.  There is a lot more information saved/restored than just the Document.

Page cache is not only a precedented name, but is also somewhat accurate.  That's why we've finally gotten people to call it "page cache" instead of "back/forward cache" after all these years.  :)
Comment 21 Brady Eidson 2011-07-06 10:33:14 PDT
(In reply to comment #19)
> Still, what better time to give it a better name than when designing a new API from scratch?

I'm not adverse to giving "page cache" a better name.

But "document cache" is not that name, because it is inaccurate.
Comment 22 Sam Weinig 2011-07-06 10:48:22 PDT
(In reply to comment #21)
> (In reply to comment #19)
> > Still, what better time to give it a better name than when designing a new API from scratch?
> 
> I'm not adverse to giving "page cache" a better name.
> 
> But "document cache" is not that name, because it is inaccurate.

Maybe BackForwardCache?
Comment 23 Brady Eidson 2011-07-06 10:59:57 PDT
(In reply to comment #22)
> (In reply to comment #21)
> > But "document cache" is not that name, because it is inaccurate.
> 
> Maybe BackForwardCache?

(In reply to comment #20)
> Page cache is not only a precedented name, but is also somewhat accurate.  That's why we've finally gotten people to call it "page cache" instead of "back/forward cache" after all these years.  :)

No.
Comment 24 Jessie Berlin 2011-07-06 12:02:02 PDT
(In reply to comment #19)
> Still, what better time to give it a better name than when designing a new API from scratch?

After further discussion with Alexey and Brady, I am going to try to make this API more about document life-time.