ASSIGNED 63849
WebKit2: Need callbacks for when a page goes in and out of the WebCore cache
https://bugs.webkit.org/show_bug.cgi?id=63849
Summary WebKit2: Need callbacks for when a page goes in and out of the WebCore cache
Jessie Berlin
Reported 2011-07-01 14:30:25 PDT
Attachments
Patch (53.15 KB, patch)
2011-07-01 16:25 PDT, Jessie Berlin
no flags
Patch (Take 2) (53.35 KB, patch)
2011-07-03 14:55 PDT, Jessie Berlin
no flags
Patch (using BundleNodeHandles instead of document ids) (54.88 KB, patch)
2011-07-05 12:13 PDT, Jessie Berlin
gyuyoung.kim: commit-queue-
Patch (first build-fix attempt) (55.09 KB, patch)
2011-07-05 12:32 PDT, Jessie Berlin
sam: review+
Jessie Berlin
Comment 1 2011-07-01 16:25:56 PDT
Andy Estes
Comment 2 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.
Jessie Berlin
Comment 3 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!
Jessie Berlin
Comment 4 2011-07-03 14:55:14 PDT
Created attachment 99581 [details] Patch (Take 2)
Sam Weinig
Comment 5 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.
Jessie Berlin
Comment 6 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)?
Sam Weinig
Comment 7 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.
Jessie Berlin
Comment 8 2011-07-05 12:13:21 PDT
Created attachment 99734 [details] Patch (using BundleNodeHandles instead of document ids)
Gyuyoung Kim
Comment 9 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
WebKit Review Bot
Comment 10 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
Early Warning System Bot
Comment 11 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
Collabora GTK+ EWS bot
Comment 12 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
WebKit Review Bot
Comment 13 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
Jessie Berlin
Comment 14 2011-07-05 12:32:00 PDT
Created attachment 99736 [details] Patch (first build-fix attempt)
Adam Roben (:aroben)
Comment 15 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?
Sam Weinig
Comment 16 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.
Adam Roben (:aroben)
Comment 17 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?
Adam Roben (:aroben)
Comment 18 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.
Adam Roben (:aroben)
Comment 19 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?
Brady Eidson
Comment 20 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. :)
Brady Eidson
Comment 21 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.
Sam Weinig
Comment 22 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?
Brady Eidson
Comment 23 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.
Jessie Berlin
Comment 24 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.
Note You need to log in before you can comment on or make changes to this bug.