- Revision
- 153458
- Author
- [email protected]
- Date
- 2013-07-29 21:45:06 -0700 (Mon, 29 Jul 2013)
Log Message
[wk2] Flush the WebProcess’ implicit transaction when using endDeferringViewInWindowChangesSync
https://bugs.webkit.org/show_bug.cgi?id=119225
<rdar://problem/14568841>
Reviewed by Simon Fraser.
Tell CoreAnimation to flush the implicit transaction before replying
when using endDeferringViewInWindowChangesSync, as that method's contract
is that the WebProcess is totally ready to be in-window when it returns.
* UIProcess/API/mac/WKView.mm:
(-[WKView endDeferringViewInWindowChanges]):
Adopt viewInWindowStateDidChange.
(-[WKView endDeferringViewInWindowChangesSync]):
Adopt viewInWindowStateDidChange, asking it to send a reply only if we're going to wait for one.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewInWindowStateDidChange):
(WebKit::WebPageProxy::viewStateDidChange):
Pull viewInWindowStateDidChange out of viewStateDidChange.
Request a reply from SetIsInWindow if we're told to.
* UIProcess/WebPageProxy.h: Add WantsReplyOrNot and viewInWindowStateDidChange.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didUpdateInWindowStateTimerFired):
Don't build this version on Mac, we'll have a WebPageMac version.
(WebKit::WebPage::setIsInWindow):
Only start the timer to send the didUpdateInWindowState reply if we're asked to.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Add an argument to the SetIsInWindow message for whether the WebProcess
should inform the UIProcess when SetIsInWindow completes or not.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::didUpdateInWindowStateTimerFired):
Tell CA to flush the implicit transaction before telling the UIProcess that
we're finished moving in-window.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (153457 => 153458)
--- trunk/Source/WebKit2/ChangeLog 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/ChangeLog 2013-07-30 04:45:06 UTC (rev 153458)
@@ -1,5 +1,48 @@
2013-07-29 Tim Horton <[email protected]>
+ [wk2] Flush the WebProcess’ implicit transaction when using endDeferringViewInWindowChangesSync
+ https://bugs.webkit.org/show_bug.cgi?id=119225
+ <rdar://problem/14568841>
+
+ Reviewed by Simon Fraser.
+
+ Tell CoreAnimation to flush the implicit transaction before replying
+ when using endDeferringViewInWindowChangesSync, as that method's contract
+ is that the WebProcess is totally ready to be in-window when it returns.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView endDeferringViewInWindowChanges]):
+ Adopt viewInWindowStateDidChange.
+
+ (-[WKView endDeferringViewInWindowChangesSync]):
+ Adopt viewInWindowStateDidChange, asking it to send a reply only if we're going to wait for one.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::viewInWindowStateDidChange):
+ (WebKit::WebPageProxy::viewStateDidChange):
+ Pull viewInWindowStateDidChange out of viewStateDidChange.
+ Request a reply from SetIsInWindow if we're told to.
+
+ * UIProcess/WebPageProxy.h: Add WantsReplyOrNot and viewInWindowStateDidChange.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::didUpdateInWindowStateTimerFired):
+ Don't build this version on Mac, we'll have a WebPageMac version.
+
+ (WebKit::WebPage::setIsInWindow):
+ Only start the timer to send the didUpdateInWindowState reply if we're asked to.
+
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ Add an argument to the SetIsInWindow message for whether the WebProcess
+ should inform the UIProcess when SetIsInWindow completes or not.
+
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::didUpdateInWindowStateTimerFired):
+ Tell CA to flush the implicit transaction before telling the UIProcess that
+ we're finished moving in-window.
+
+2013-07-29 Tim Horton <[email protected]>
+
Null deref under PluginView::handlesPageScaleFactor()
https://bugs.webkit.org/show_bug.cgi?id=119231
<rdar://problem/14440207>
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (153457 => 153458)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-07-30 04:45:06 UTC (rev 153458)
@@ -3316,7 +3316,7 @@
_data->_shouldDeferViewInWindowChanges = NO;
if (_data->_viewInWindowChangeWasDeferred) {
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsInWindow);
+ _data->_page->viewInWindowStateDidChange();
_data->_viewInWindowChangeWasDeferred = NO;
}
}
@@ -3331,8 +3331,13 @@
PageClient* pageClient = _data->_pageClient.get();
bool hasPendingViewInWindowChange = _data->_viewInWindowChangeWasDeferred && _data->_page->isInWindow() != pageClient->isViewInWindow();
- [self endDeferringViewInWindowChanges];
+ _data->_shouldDeferViewInWindowChanges = NO;
+ if (_data->_viewInWindowChangeWasDeferred) {
+ _data->_page->viewInWindowStateDidChange(hasPendingViewInWindowChange ? WebPageProxy::WantsReplyOrNot::DoesWantReply : WebPageProxy::WantsReplyOrNot::DoesNotWantReply);
+ _data->_viewInWindowChangeWasDeferred = NO;
+ }
+
if (hasPendingViewInWindowChange)
_data->_page->waitForDidUpdateInWindowState();
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (153457 => 153458)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-07-30 04:45:06 UTC (rev 153458)
@@ -1040,6 +1040,26 @@
m_pageClient->scrollView(scrollRect, scrollOffset);
}
+void WebPageProxy::viewInWindowStateDidChange(WantsReplyOrNot wantsReply)
+{
+ if (!isValid())
+ return;
+
+ bool isInWindow = m_pageClient->isViewInWindow();
+ if (m_isInWindow != isInWindow) {
+ m_isInWindow = isInWindow;
+ m_process->send(Messages::WebPage::SetIsInWindow(isInWindow, wantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
+ }
+
+ if (isInWindow) {
+ LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
+ if (m_layerHostingMode != layerHostingMode) {
+ m_layerHostingMode = layerHostingMode;
+ m_drawingArea->layerHostingModeDidChange();
+ }
+ }
+}
+
void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
{
if (!isValid())
@@ -1072,22 +1092,9 @@
}
}
- if (flags & ViewIsInWindow) {
- bool isInWindow = m_pageClient->isViewInWindow();
- if (m_isInWindow != isInWindow) {
- m_isInWindow = isInWindow;
- m_process->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
- }
+ if (flags & ViewIsInWindow)
+ viewInWindowStateDidChange();
- if (isInWindow) {
- LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
- if (m_layerHostingMode != layerHostingMode) {
- m_layerHostingMode = layerHostingMode;
- m_drawingArea->layerHostingModeDidChange();
- }
- }
- }
-
#if ENABLE(PAGE_VISIBILITY_API)
PageVisibilityState visibilityState = PageVisibilityStateHidden;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (153457 => 153458)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-07-30 04:45:06 UTC (rev 153458)
@@ -343,6 +343,8 @@
};
typedef unsigned ViewStateFlags;
void viewStateDidChange(ViewStateFlags flags);
+ enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
+ void viewInWindowStateDidChange(WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
bool isInWindow() const { return m_isInWindow; }
void waitForDidUpdateInWindowState();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (153457 => 153458)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2013-07-30 04:45:06 UTC (rev 153458)
@@ -2113,10 +2113,12 @@
m_page->setCanStartMedia(true);
}
+#if !PLATFORM(MAC)
void WebPage::didUpdateInWindowStateTimerFired()
{
send(Messages::WebPageProxy::DidUpdateInWindowState());
}
+#endif
inline bool WebPage::canHandleUserEvents() const
{
@@ -2127,7 +2129,7 @@
return true;
}
-void WebPage::setIsInWindow(bool isInWindow)
+void WebPage::setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState)
{
bool pageWasInWindow = m_page->isInWindow();
@@ -2152,7 +2154,9 @@
}
m_page->setIsInWindow(isInWindow);
- m_sendDidUpdateInWindowStateTimer.startOneShot(0);
+
+ if (wantsDidUpdateViewInWindowState)
+ m_sendDidUpdateInWindowStateTimer.startOneShot(0);
}
void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (153457 => 153458)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2013-07-30 04:45:06 UTC (rev 153458)
@@ -709,7 +709,7 @@
void setFocused(bool);
void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
void setWindowResizerSize(const WebCore::IntSize&);
- void setIsInWindow(bool);
+ void setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState = false);
void validateCommand(const String&, uint64_t);
void executeEditCommand(const String&);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (153457 => 153458)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2013-07-30 04:45:06 UTC (rev 153458)
@@ -24,7 +24,7 @@
SetActive(bool active)
SetFocused(bool focused)
SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event)
- SetIsInWindow(bool isInWindow)
+ SetIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState)
SetDrawsBackground(bool drawsBackground)
SetDrawsTransparentBackground(bool drawsTransparentBackground)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (153457 => 153458)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2013-07-30 04:33:35 UTC (rev 153457)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2013-07-30 04:45:06 UTC (rev 153458)
@@ -972,4 +972,10 @@
}
}
+void WebPage::didUpdateInWindowStateTimerFired()
+{
+ [CATransaction flush];
+ send(Messages::WebPageProxy::DidUpdateInWindowState());
+}
+
} // namespace WebKit