Title: [187649] branches/safari-601.1-branch/Source/WebKit2
Revision
187649
Author
lforsch...@apple.com
Date
2015-07-31 09:35:39 -0700 (Fri, 31 Jul 2015)

Log Message

Merged r187471.  rdar://problem/22021772

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187648 => 187649)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-31 16:33:47 UTC (rev 187648)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-31 16:35:39 UTC (rev 187649)
@@ -1,5 +1,33 @@
 2015-07-31  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r187471
+
+    2015-07-27  Tim Horton  <timothy_hor...@apple.com>
+
+            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.
+
+2015-07-31  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r187462
 
     2015-07-27  Tim Horton  <timothy_hor...@apple.com>

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (187648 => 187649)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-31 16:33:47 UTC (rev 187648)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-07-31 16:35:39 UTC (rev 187649)
@@ -1330,10 +1330,8 @@
         m_viewState |= ViewState::IsVisible;
     if (flagsToUpdate & ViewState::IsVisibleOrOccluded && m_pageClient.isViewVisibleOrOccluded())
         m_viewState |= ViewState::IsVisibleOrOccluded;
-    if (flagsToUpdate & ViewState::IsInWindow && m_pageClient.isViewInWindow()) {
+    if (flagsToUpdate & ViewState::IsInWindow && m_pageClient.isViewInWindow())
         m_viewState |= ViewState::IsInWindow;
-        m_viewWasEverInWindow = true;
-    }
     if (flagsToUpdate & ViewState::IsVisuallyIdle && m_pageClient.isVisuallyIdle())
         m_viewState |= ViewState::IsVisuallyIdle;
 }
@@ -1401,8 +1399,9 @@
     updateViewState(m_potentiallyChangedViewStateFlags);
     ViewState::Flags changed = m_viewState ^ previousViewState;
 
+    bool isNowInWindow = (changed & ViewState::IsInWindow) && isInWindow();
     // We always want to wait for the Web process to reply if we've been in-window before and are coming back in-window.
-    if (m_viewWasEverInWindow && (changed & ViewState::IsInWindow) && isInWindow() && m_drawingArea->hasVisibleContent())
+    if (m_viewWasEverInWindow && isNowInWindow && m_drawingArea->hasVisibleContent())
         m_viewStateChangeWantsSynchronousReply = true;
 
     // Don't wait synchronously if the view state is not visible. (This matters in particular on iOS, where a hidden page may be suspended.)
@@ -1437,6 +1436,7 @@
 
     m_potentiallyChangedViewStateFlags = ViewState::NoFlags;
     m_viewStateChangeWantsSynchronousReply = false;
+    m_viewWasEverInWindow |= isNowInWindow;
 }
 
 void WebPageProxy::updateActivityToken()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to