[webkit-reviews] review granted: [Bug 195223] Add a WebViewDidMoveToWindowObserver for WKWebView : [Attachment 363365] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 3 12:19:15 PST 2019

Darin Adler <darin at apple.com> has granted Jiewen Tan <jiewen_tan at apple.com>'s
request for review:
Bug 195223: Add a WebViewDidMoveToWindowObserver for WKWebView

Attachment 363365: Patch


--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 363365
  --> https://bugs.webkit.org/attachment.cgi?id=363365

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

> Source/WebKit/UIProcess/WebPageProxy.h:1467
> +    void addWebViewDidMoveToWindowObserver(WebViewDidMoveToWindowObserver&);
> +    void

I think these functions could have shorter names. C++ overloading means they
could have names as short as "add/remove", but I was thinking

Can the remove function take a reference instead of a pointer? Is there a
caller that needs to call it with null?

> Source/WebKit/UIProcess/WebPageProxy.h:2389
> +    HashMap<WebViewDidMoveToWindowObserver*,
WeakPtr<WebViewDidMoveToWindowObserver>> m_webViewDidMoveToWindowObservers;

Is a WeakPtr the optimal pattern here? Where else are we using that for

Since this entire observer function is just a "call this function" thing, maybe
we could do something with functions instead? Unless this is a common pattern.

More information about the webkit-reviews mailing list