Changeset 187471 in webkit


Ignore:
Timestamp:
Jul 27, 2015 5:43:04 PM (9 years ago)
Author:
timothy_horton@apple.com
Message:

First in-window viewStateChange synchronously blocks despite not previously being in-window
https://bugs.webkit.org/show_bug.cgi?id=147344
<rdar://problem/22021772>

Reviewed by Simon Fraser.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::updateViewState):
(WebKit::WebPageProxy::dispatchViewStateChange):
The whole point of m_viewWasEverInWindow was so that we would not
synchronously wait when a view was added to a window for the first time,
only all subsequent times.

However, since m_viewWasEverInWindow was being set *before* being
checked in dispatchViewStateChange, we were always blocking. This is
a huge waste of main-thread time, because there's no reason to wait
for the first paint if you've never seen the view before (and shouldn't
expect it to have content).

Instead, set the flag after dispatching a view state change, so it becomes
"have we ever sent a view state with IsInWindow set" instead.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r187462 r187471  
     12015-07-27  Tim Horton  <timothy_horton@apple.com>
     2
     3        First in-window viewStateChange synchronously blocks despite not previously being in-window
     4        https://bugs.webkit.org/show_bug.cgi?id=147344
     5        <rdar://problem/22021772>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/WebPageProxy.cpp:
     10        (WebKit::WebPageProxy::updateViewState):
     11        (WebKit::WebPageProxy::dispatchViewStateChange):
     12        The whole point of m_viewWasEverInWindow was so that we would not
     13        synchronously wait when a view was added to a window for the first time,
     14        only all subsequent times.
     15
     16        However, since m_viewWasEverInWindow was being set *before* being
     17        checked in dispatchViewStateChange, we were always blocking. This is
     18        a huge waste of main-thread time, because there's no reason to wait
     19        for the first paint if you've never seen the view before (and shouldn't
     20        expect it to have content).
     21
     22        Instead, set the flag after dispatching a view state change, so it becomes
     23        "have we ever sent a view state with IsInWindow set" instead.
     24
    1252015-07-27  Tim Horton  <timothy_horton@apple.com>
    226
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r187272 r187471  
    13311331    if (flagsToUpdate & ViewState::IsVisibleOrOccluded && m_pageClient.isViewVisibleOrOccluded())
    13321332        m_viewState |= ViewState::IsVisibleOrOccluded;
    1333     if (flagsToUpdate & ViewState::IsInWindow && m_pageClient.isViewInWindow()) {
     1333    if (flagsToUpdate & ViewState::IsInWindow && m_pageClient.isViewInWindow())
    13341334        m_viewState |= ViewState::IsInWindow;
    1335         m_viewWasEverInWindow = true;
    1336     }
    13371335    if (flagsToUpdate & ViewState::IsVisuallyIdle && m_pageClient.isVisuallyIdle())
    13381336        m_viewState |= ViewState::IsVisuallyIdle;
     
    14021400    ViewState::Flags changed = m_viewState ^ previousViewState;
    14031401
     1402    bool isNowInWindow = (changed & ViewState::IsInWindow) && isInWindow();
    14041403    // We always want to wait for the Web process to reply if we've been in-window before and are coming back in-window.
    1405     if (m_viewWasEverInWindow && (changed & ViewState::IsInWindow) && isInWindow() && m_drawingArea->hasVisibleContent())
     1404    if (m_viewWasEverInWindow && isNowInWindow && m_drawingArea->hasVisibleContent())
    14061405        m_viewStateChangeWantsSynchronousReply = true;
    14071406
     
    14381437    m_potentiallyChangedViewStateFlags = ViewState::NoFlags;
    14391438    m_viewStateChangeWantsSynchronousReply = false;
     1439    m_viewWasEverInWindow |= isNowInWindow;
    14401440}
    14411441
Note: See TracChangeset for help on using the changeset viewer.