⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 185799 in webkit


Ignore:
Timestamp:
Jun 20, 2015, 1:50:35 PM (11 years ago)
Author:
Chris Dumez
Message:

[WK2][iOS] Avoid synchronous IPC on view state change when the content is not visible
https://bugs.webkit.org/show_bug.cgi?id=146179
<rdar://problem/20923432>

Reviewed by Tim Horton.

After r170787, viewStateChange() would cause a synchronous IPC between
the UIProcess and the WebProcess when the view becomes visible. This
was to avoid painting empty / black tiles when unsuspending the
WebProcess on tab switch, in the event volatile IOSurfaces were purged.

However, this sync IPC can have performance implications and is not
needed when the content is not actually visible yet (e.g.
hideContentUntilNextUpdate() was called, or the tab was killed).

This patch avoids the synchronous IPC when the content is hidden and
exposes a private API on WKWebView so that clients can ask for the
content to be hidden until the next update. This would allow for
clients to avoid the synchronous IPC if they don't need the content
to be displayed synchronously (e.g. the view is obscured).

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _hideContentUntilNextUpdate]):

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:
  • UIProcess/DrawingAreaProxy.h:

(WebKit::DrawingAreaProxy::hasVisibleContent):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::dispatchViewStateChange):

  • UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
  • UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::isContentHidden):

Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185795 r185799  
     12015-06-20  Chris Dumez  <cdumez@apple.com>
     2
     3        [WK2][iOS] Avoid synchronous IPC on view state change when the content is not visible
     4        https://bugs.webkit.org/show_bug.cgi?id=146179
     5        <rdar://problem/20923432>
     6
     7        Reviewed by Tim Horton.
     8
     9        After r170787, viewStateChange() would cause a synchronous IPC between
     10        the UIProcess and the WebProcess when the view becomes visible. This
     11        was to avoid painting empty / black tiles when unsuspending the
     12        WebProcess on tab switch, in the event volatile IOSurfaces were purged.
     13
     14        However, this sync IPC can have performance implications and is not
     15        needed when the content is not actually visible yet (e.g.
     16        hideContentUntilNextUpdate() was called, or the tab was killed).
     17
     18        This patch avoids the synchronous IPC when the content is hidden and
     19        exposes a private API on WKWebView so that clients can ask for the
     20        content to be hidden until the next update. This would allow for
     21        clients to avoid the synchronous IPC if they don't need the content
     22        to be displayed synchronously (e.g. the view is obscured).
     23
     24        * UIProcess/API/Cocoa/WKWebView.mm:
     25        (-[WKWebView _hideContentUntilNextUpdate]):
     26        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     27        * UIProcess/DrawingAreaProxy.h:
     28        (WebKit::DrawingAreaProxy::hasVisibleContent):
     29        * UIProcess/WebPageProxy.cpp:
     30        (WebKit::WebPageProxy::dispatchViewStateChange):
     31        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
     32        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
     33        (WebKit::RemoteLayerTreeDrawingAreaProxy::isContentHidden):
     34
    1352015-06-20  Michael Catanzaro  <mcatanzaro@igalia.com>
    236
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r185727 r185799  
    25922592}
    25932593
     2594- (void)_hideContentUntilNextUpdate
     2595{
     2596    if (auto* area = _page->drawingArea())
     2597        area->hideContentUntilNextUpdate();
     2598}
     2599
    25942600- (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock
    25952601{
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r185331 r185799  
    135135- (void)_beginInteractiveObscuredInsetsChange;
    136136- (void)_endInteractiveObscuredInsetsChange;
     137- (void)_hideContentUntilNextUpdate;
    137138
    138139- (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock;
  • trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h

    r183841 r185799  
    9191
    9292    virtual void hideContentUntilNextUpdate() { ASSERT_NOT_REACHED(); }
     93    virtual bool hasVisibleContent() const { return true; }
    9394
    9495    virtual void willSendUpdateGeometry() { }
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r185795 r185799  
    13731373
    13741374    // We always want to wait for the Web process to reply if we've been in-window before and are coming back in-window.
    1375     if (m_viewWasEverInWindow && (changed & ViewState::IsInWindow) && isInWindow())
     1375    if (m_viewWasEverInWindow && (changed & ViewState::IsInWindow) && isInWindow() && m_drawingArea->hasVisibleContent())
    13761376        m_viewStateChangeWantsSynchronousReply = true;
    13771377
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h

    r183841 r185799  
    4040class RemoteScrollingCoordinatorTransaction;
    4141
    42 class RemoteLayerTreeDrawingAreaProxy : public DrawingAreaProxy {
     42class RemoteLayerTreeDrawingAreaProxy final : public DrawingAreaProxy {
    4343public:
    4444    explicit RemoteLayerTreeDrawingAreaProxy(WebPageProxy&);
     
    7878    virtual void waitForDidUpdateViewState() override;
    7979    virtual void hideContentUntilNextUpdate() override;
     80    virtual bool hasVisibleContent() const override;
    8081   
    8182    WebCore::FloatPoint indicatorLocation() const;
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm

    r184679 r185799  
    422422}
    423423
     424bool RemoteLayerTreeDrawingAreaProxy::hasVisibleContent() const
     425{
     426    return m_remoteLayerTreeHost.rootLayer();
     427}
     428
    424429} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.