Bug 221020

Summary: Add plumbing to allow AppHighlights to be stored.
Product: WebKit Reporter: Megan Gardner <megan_gardner>
Component: New BugsAssignee: Megan Gardner <megan_gardner>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, esprehn+autocc, ews-watchlist, hi, japhet, kangil.han, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch for landing none

Megan Gardner
Reported 2021-01-26 17:44:09 PST
Add plumbing to allow AppHighlights to be stored.
Attachments
Patch (22.07 KB, patch)
2021-01-26 18:02 PST, Megan Gardner
no flags
Patch (24.21 KB, patch)
2021-01-26 20:59 PST, Megan Gardner
no flags
Patch (24.21 KB, patch)
2021-01-27 10:24 PST, Megan Gardner
no flags
Patch (23.74 KB, patch)
2021-01-27 11:20 PST, Megan Gardner
no flags
Patch (29.85 KB, patch)
2021-01-27 22:37 PST, Megan Gardner
ews-feeder: commit-queue-
Patch (29.56 KB, patch)
2021-01-27 23:39 PST, Megan Gardner
no flags
Patch (29.59 KB, patch)
2021-01-28 10:30 PST, Megan Gardner
no flags
Patch for landing (29.64 KB, patch)
2021-01-28 17:40 PST, Megan Gardner
no flags
Megan Gardner
Comment 1 2021-01-26 18:02:16 PST
Tim Horton
Comment 2 2021-01-26 18:06:55 PST
Comment on attachment 418494 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418494&action=review > Source/WebCore/Modules/highlight/AppHighlightStorage.cpp:212 > +void AppHighlightStorage::createAndSendAppHighlightsStorage() "send" is weird. Also, should this all really be called "update"? Does it get called whenever things change? > Source/WebCore/page/ChromeClient.h:306 > + virtual void didCreateHighlightsStorageData(Ref<WebCore::SharedBuffer>&&) const = 0; Ditto all the way through wondering if "didCreate" is the right verb > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1406 > +#if ENABLE(APP_HIGHLIGHT) It's gotta be APP_HIGHLIGHT or APP_HIGHLIGHTS, can't be both. Did you test this? > Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightStorageDelegate.h:28 > +@protocol _WKAppHighlightStorageDelegate <NSObject> If you're going to add a new delegate, I would be /bold/ and drop the "storage" > Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightStorageDelegate.h:32 > +- (void)_webView:(WKWebView *)webView didCreateHighlightsStorageData:(NSData *)data; Ditto with the name > Source/WebKit/UIProcess/WebPageProxy.messages.in:539 > + DidCreateHighlightsStorageData(IPC::SharedBufferCopy data) // <MMG> SharedBufferDataReference instead?? <MMG>
Megan Gardner
Comment 3 2021-01-26 20:59:29 PST
Megan Gardner
Comment 4 2021-01-27 10:24:45 PST
Megan Gardner
Comment 5 2021-01-27 11:20:29 PST
Wenson Hsieh
Comment 6 2021-01-27 14:28:02 PST
Comment on attachment 418566 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418566&action=review > Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:99 > + RetainPtr<NSData> nsData = imageBuffer->createNSData(); s/imageBuffer/data/ here? Also, do we need a .get() below?
Devin Rousso
Comment 7 2021-01-27 14:51:57 PST
Comment on attachment 418566 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418566&action=review > Source/WebCore/Modules/highlight/AppHighlightStorage.cpp:228 > + m_document->page()->chrome().updateAppHighlightsStorage(listData.toSharedBuffer()); NIT: should we null-check `m_document->page()`? I think currently it's assumed to exist since this is only called from `WebPage::createAppHighlightInSelectedRange` which also assumes `m_page`. Is it possible for anything in the loop to disconnect the document? > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1954 > +- (id <_WKAppHighlightDelegate>)_appHighlightsDelegate Do we need an `#import` for this? Also, should this be a private/internal `@property`? > Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:1956 > + return _appHighlightsDelegate.getAutoreleased(); Do we need an `_appHighlightsDelegate` ivar? > Source/WebKit/UIProcess/API/Cocoa/_WKAppHighlightStorageDelegate.h:28 > +@protocol _WKAppHighlightDelegate <NSObject> This should match the filename (or vice versa). >> Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm:99 >> + RetainPtr<NSData> nsData = imageBuffer->createNSData(); > > s/imageBuffer/data/ here? Also, do we need a .get() below? NIT: also `auto`? > Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:1244 > + m_page.send(Messages::WebPageProxy::UpdateAppHighlightsStorage(data)); Should this be `WTFMove(data)`?
Megan Gardner
Comment 8 2021-01-27 22:37:13 PST
Megan Gardner
Comment 9 2021-01-27 23:39:08 PST
Megan Gardner
Comment 10 2021-01-28 10:30:37 PST
Devin Rousso
Comment 11 2021-01-28 17:07:45 PST
Comment on attachment 418654 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418654&action=review r=me > Source/WebKit/UIProcess/WebPageProxy.cpp:9924 > + pageClient().updateAppHighlightsStorage(*data.buffer()); NIT: should we check `data.buffer()` before dereferencing it (especially since it's a message from the WebProcess)?
Chris Dumez
Comment 12 2021-01-28 17:20:44 PST
Comment on attachment 418654 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=418654&action=review >> Source/WebKit/UIProcess/WebPageProxy.cpp:9924 >> + pageClient().updateAppHighlightsStorage(*data.buffer()); > > NIT: should we check `data.buffer()` before dereferencing it (especially since it's a message from the WebProcess)? Indeed, you likely want a MESSAGE_CHECK(data.buffer()); at the beginning of this function.
Megan Gardner
Comment 13 2021-01-28 17:40:24 PST
Created attachment 418686 [details] Patch for landing
EWS
Comment 14 2021-01-28 18:21:42 PST
Committed r272042: <https://trac.webkit.org/changeset/272042> All reviewed patches have been landed. Closing bug and clearing flags on attachment 418686 [details].
Radar WebKit Bug Importer
Comment 15 2021-01-28 18:22:14 PST
Note You need to log in before you can comment on or make changes to this bug.