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

Changeset 170787 in webkit


Ignore:
Timestamp:
Jul 4, 2014, 12:10:10 AM (12 years ago)
Author:
timothy_horton@apple.com
Message:

[iOS][WK2] Black web view after un-suspending process
https://bugs.webkit.org/show_bug.cgi?id=134623
<rdar://problem/17513223>

Reviewed by Simon Fraser.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::viewStateDidChange):
Add an argument to viewStateDidChange that allows callers (-[WKContentView _applicationWillEnterForeground:])
to force us to wait for a synchronous reply from the Web process after performing a view state change.

(WebKit::WebPageProxy::dispatchViewStateChange):
Move the has-been-in-window-and-now-is-newly-in-window check into dispatchViewStateChange.
Adjust the logic surrounding going into/out of window by factoring out the IsInWindow-did-change check, for clarity.

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WKContentView.mm:

(-[WKContentView _applicationWillEnterForeground:]):
As previously mentioned, wait for a reply when foregrounding.

  • WebProcess/WebPage/DrawingArea.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:

(WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately):
(WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
(WebKit::RemoteLayerTreeDrawingArea::viewStateDidChange):
Make sure to schedule a commit immediately if the UI process is waiting for a reply.
Previously we assumed that a commit would be scheduled anyway because we would have to reparent the
layer tree, but that doesn't happen in the suspension-without-unparenting case. Also, we want to skip
all throttling in this case.

  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
  • WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:

(WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):

Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r170785 r170787  
     12014-07-04  Timothy Horton  <timothy_horton@apple.com>
     2
     3        [iOS][WK2] Black web view after un-suspending process
     4        https://bugs.webkit.org/show_bug.cgi?id=134623
     5        <rdar://problem/17513223>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/WebPageProxy.cpp:
     10        (WebKit::WebPageProxy::viewStateDidChange):
     11        Add an argument to viewStateDidChange that allows callers (-[WKContentView _applicationWillEnterForeground:])
     12        to force us to wait for a synchronous reply from the Web process after performing a view state change.
     13
     14        (WebKit::WebPageProxy::dispatchViewStateChange):
     15        Move the has-been-in-window-and-now-is-newly-in-window check into dispatchViewStateChange.
     16        Adjust the logic surrounding going into/out of window by factoring out the IsInWindow-did-change check, for clarity.
     17
     18        * UIProcess/WebPageProxy.h:
     19        * UIProcess/ios/WKContentView.mm:
     20        (-[WKContentView _applicationWillEnterForeground:]):
     21        As previously mentioned, wait for a reply when foregrounding.
     22
     23        * WebProcess/WebPage/DrawingArea.h:
     24        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
     25        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
     26        (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately):
     27        (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
     28        (WebKit::RemoteLayerTreeDrawingArea::viewStateDidChange):
     29        Make sure to schedule a commit immediately if the UI process is waiting for a reply.
     30        Previously we assumed that a commit would be scheduled anyway because we would have to reparent the
     31        layer tree, but that doesn't happen in the suspension-without-unparenting case. Also, we want to skip
     32        all throttling in this case.
     33
     34        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
     35        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
     36        (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
     37
    1382014-07-03  Gavin Barraclough  <baraclough@apple.com>
    239
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r170776 r170787  
    367367    , m_configurationPreferenceValues(configuration.preferenceValues)
    368368    , m_potentiallyChangedViewStateFlags(ViewState::NoFlags)
    369     , m_viewStateChangeWantsReply(WantsReplyOrNot::DoesNotWantReply)
     369    , m_viewStateChangeWantsReply(false)
    370370{
    371371    if (m_process->state() == WebProcessProxy::State::Running) {
     
    11021102}
    11031103
    1104 void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged)
    1105 {
    1106     bool isNewlyInWindow = !isInWindow() && (mayHaveChanged & ViewState::IsInWindow) && m_pageClient.isViewInWindow();
    1107 
     1104void WebPageProxy::viewStateDidChange(ViewState::Flags mayHaveChanged, bool wantsReply)
     1105{
    11081106    m_potentiallyChangedViewStateFlags |= mayHaveChanged;
    1109     m_viewStateChangeWantsReply = ((m_viewWasEverInWindow && isNewlyInWindow) || m_viewStateChangeWantsReply == WantsReplyOrNot::DoesWantReply) ? WantsReplyOrNot::DoesWantReply : WantsReplyOrNot::DoesNotWantReply;
     1107    m_viewStateChangeWantsReply = m_viewStateChangeWantsReply || wantsReply;
    11101108
    11111109#if PLATFORM(COCOA)
    1112     if (isNewlyInWindow) {
     1110    if (!isInWindow() && (mayHaveChanged & ViewState::IsInWindow) && m_pageClient.isViewInWindow()) {
    11131111        dispatchViewStateChange();
    11141112        return;
     
    11181116    dispatchViewStateChange();
    11191117#endif
     1118}
     1119
     1120void WebPageProxy::viewDidLeaveWindow()
     1121{
     1122#if ENABLE(INPUT_TYPE_COLOR_POPOVER)
     1123    // When leaving the current page, close the popover color well.
     1124    if (m_colorPicker)
     1125        endColorPicker();
     1126#endif
     1127#if PLATFORM(IOS)
     1128    // When leaving the current page, close the video fullscreen.
     1129    if (m_videoFullscreenManager)
     1130        m_videoFullscreenManager->requestHideAndExitFullscreen();
     1131#endif
     1132}
     1133
     1134void WebPageProxy::viewDidEnterWindow()
     1135{
     1136    LayerHostingMode layerHostingMode = m_pageClient.viewLayerHostingMode();
     1137    if (m_layerHostingMode != layerHostingMode) {
     1138        m_layerHostingMode = layerHostingMode;
     1139        m_process->send(Messages::WebPage::SetLayerHostingMode(static_cast<unsigned>(layerHostingMode)), m_pageID);
     1140    }
    11201141}
    11211142
     
    11391160    ViewState::Flags changed = m_viewState ^ previousViewState;
    11401161
     1162    // We always want to wait for the Web process to reply if we've been in-window before and are coming back in-window.
     1163    if (m_viewWasEverInWindow && (changed & ViewState::IsInWindow) && isInWindow())
     1164        m_viewStateChangeWantsReply = true;
     1165
    11411166    if (changed)
    1142         m_process->send(Messages::WebPage::SetViewState(m_viewState, m_viewStateChangeWantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
     1167        m_process->send(Messages::WebPage::SetViewState(m_viewState, m_viewStateChangeWantsReply), m_pageID);
    11431168
    11441169    // This must happen after the SetViewState message is sent, to ensure the page visibility event can fire.
     
    11541179        m_process->responsivenessTimer()->stop();
    11551180
    1156     if ((m_potentiallyChangedViewStateFlags & ViewState::IsInWindow) && (m_viewState & ViewState::IsInWindow)) {
    1157         LayerHostingMode layerHostingMode = m_pageClient.viewLayerHostingMode();
    1158         if (m_layerHostingMode != layerHostingMode) {
    1159             m_layerHostingMode = layerHostingMode;
    1160             m_process->send(Messages::WebPage::SetLayerHostingMode(static_cast<unsigned>(layerHostingMode)), m_pageID);
    1161         }
    1162     }
    1163 
    1164     if ((m_potentiallyChangedViewStateFlags & ViewState::IsInWindow) && !(m_viewState & ViewState::IsInWindow)) {
    1165 #if ENABLE(INPUT_TYPE_COLOR_POPOVER)
    1166         // When leaving the current page, close the popover color well.
    1167         if (m_colorPicker)
    1168             endColorPicker();
    1169 #endif
    1170 #if PLATFORM(IOS)
    1171         // When leaving the current page, close the video fullscreen.
    1172         if (m_videoFullscreenManager)
    1173             m_videoFullscreenManager->requestHideAndExitFullscreen();
    1174 #endif
     1181    if (changed & ViewState::IsInWindow) {
     1182        if (isInWindow())
     1183            viewDidEnterWindow();
     1184        else
     1185            viewDidLeaveWindow();
    11751186    }
    11761187
    11771188    updateBackingStoreDiscardableState();
    11781189
    1179     if (m_viewStateChangeWantsReply == WantsReplyOrNot::DoesWantReply)
     1190    if (m_viewStateChangeWantsReply)
    11801191        waitForDidUpdateViewState();
    11811192
    11821193    m_potentiallyChangedViewStateFlags = ViewState::NoFlags;
    1183     m_viewStateChangeWantsReply = WantsReplyOrNot::DoesNotWantReply;
     1194    m_viewStateChangeWantsReply = false;
    11841195}
    11851196
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r170782 r170787  
    361361    bool delegatesScrolling() const { return m_delegatesScrolling; }
    362362
    363     enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
    364     void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged);
     363    void viewStateDidChange(WebCore::ViewState::Flags mayHaveChanged, bool wantsReply = false);
    365364    bool isInWindow() const { return m_viewState & WebCore::ViewState::IsInWindow; }
    366365    void waitForDidUpdateViewState();
     
    12671266
    12681267    void dispatchViewStateChange();
     1268    void viewDidLeaveWindow();
     1269    void viewDidEnterWindow();
    12691270
    12701271    PageClient& m_pageClient;
     
    15141515    WebPreferencesStore::ValueMap m_configurationPreferenceValues;
    15151516    WebCore::ViewState::Flags m_potentiallyChangedViewStateFlags;
    1516     WantsReplyOrNot m_viewStateChangeWantsReply;
     1517    bool m_viewStateChangeWantsReply;
    15171518};
    15181519
  • trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm

    r170783 r170787  
    761761{
    762762    _page->applicationWillEnterForeground();
    763     _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow);
     763    _page->viewStateDidChange(ViewState::AllFlags & ~ViewState::IsInWindow, true);
    764764}
    765765
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h

    r170761 r170787  
    102102    virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
    103103    virtual void scheduleCompositingLayerFlush() = 0;
     104    virtual void scheduleCompositingLayerFlushImmediately() = 0;
    104105
    105106#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h

    r170761 r170787  
    6767    virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
    6868    virtual void scheduleCompositingLayerFlush() override;
     69    virtual void scheduleCompositingLayerFlushImmediately() override;
    6970
    7071    virtual void addTransactionCallbackID(uint64_t callbackID) override;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

    r170774 r170787  
    240240}
    241241
     242void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlushImmediately()
     243{
     244    m_layerFlushTimer.startOneShot(0_ms);
     245}
     246
    242247void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush()
    243248{
     
    249254    if (m_isLayerFlushThrottlingTemporarilyDisabledForInteraction) {
    250255        m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = false;
    251         m_layerFlushTimer.startOneShot(0_ms);
     256        scheduleCompositingLayerFlushImmediately();
    252257        return;
    253258    }
     
    428433{
    429434    // FIXME: Should we suspend painting while not visible, like TiledCoreAnimationDrawingArea? Probably.
     435
     436    if (wantsDidUpdateViewState)
     437        scheduleCompositingLayerFlushImmediately();
    430438}
    431439
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h

    r170319 r170787  
    6868    virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
    6969    virtual void scheduleCompositingLayerFlush() override;
     70    virtual void scheduleCompositingLayerFlushImmediately() override;
    7071
    7172    virtual void updatePreferences(const WebPreferencesStore&) override;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r170557 r170787  
    175175}
    176176
     177void TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately()
     178{
     179    scheduleCompositingLayerFlush();
     180}
     181
    177182void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore&)
    178183{
Note: See TracChangeset for help on using the changeset viewer.