Title: [149761] trunk/Source/WebKit2
- Revision
- 149761
- Author
- [email protected]
- Date
- 2013-05-08 13:02:45 -0700 (Wed, 08 May 2013)
Log Message
Coalesce WKView visibleRect changes
https://bugs.webkit.org/show_bug.cgi?id=115792
<rdar://problem/13776842>
Reviewed by Simon Fraser.
The system can call renewGState much more often than we actually want
to update the WebProcess' notion of the exposed rect. Most importantly,
within an autolayout pass it is called many times, and often sees
[WKView visibleRect] be an intermediate value which will never be
flushed to the screen. We only care about the final value, so we should
wait until AppKit has finished - with a zero-delay timer - to inform the
WebProcess of exposed rect changes.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
Add exposedRectChangedTimer.
(WebKit::WebPageProxy::close):
Cancel exposedRectChangedTimer when tearing down the WebPageProxy.
* UIProcess/WebPageProxy.h:
(WebPageProxy):
Add exposedRectChangedTimerFired, the timer itself, and two rects:
the most recent exposed rect from the WKView, and the last one we actually
sent across to the WebProcess.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::viewExposedRectChanged):
Instead of immediately sending exposed rect changes to the WebProcess,
start a zero-delay timer to do so.
(WebKit::WebPageProxy::exposedRectChangedTimerFired):
Once the zero-delay timer fires, send the new exposed rect to the WebProcess.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (149760 => 149761)
--- trunk/Source/WebKit2/ChangeLog 2013-05-08 19:47:30 UTC (rev 149760)
+++ trunk/Source/WebKit2/ChangeLog 2013-05-08 20:02:45 UTC (rev 149761)
@@ -1,3 +1,36 @@
+2013-05-08 Tim Horton <[email protected]>
+
+ Coalesce WKView visibleRect changes
+ https://bugs.webkit.org/show_bug.cgi?id=115792
+ <rdar://problem/13776842>
+
+ Reviewed by Simon Fraser.
+
+ The system can call renewGState much more often than we actually want
+ to update the WebProcess' notion of the exposed rect. Most importantly,
+ within an autolayout pass it is called many times, and often sees
+ [WKView visibleRect] be an intermediate value which will never be
+ flushed to the screen. We only care about the final value, so we should
+ wait until AppKit has finished - with a zero-delay timer - to inform the
+ WebProcess of exposed rect changes.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ Add exposedRectChangedTimer.
+ (WebKit::WebPageProxy::close):
+ Cancel exposedRectChangedTimer when tearing down the WebPageProxy.
+ * UIProcess/WebPageProxy.h:
+ (WebPageProxy):
+ Add exposedRectChangedTimerFired, the timer itself, and two rects:
+ the most recent exposed rect from the WKView, and the last one we actually
+ sent across to the WebProcess.
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::viewExposedRectChanged):
+ Instead of immediately sending exposed rect changes to the WebProcess,
+ start a zero-delay timer to do so.
+ (WebKit::WebPageProxy::exposedRectChangedTimerFired):
+ Once the zero-delay timer fires, send the new exposed rect to the WebProcess.
+
2013-05-08 Alexey Proskuryakov <[email protected]>
<rdar://problem/13776220> 13A451: PluginProcess(2225) deny file-read-data ~/Library/InputManagers
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (149760 => 149761)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-05-08 19:47:30 UTC (rev 149760)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-05-08 20:02:45 UTC (rev 149761)
@@ -309,6 +309,9 @@
, m_mediaVolume(1)
, m_mayStartMediaWhenInWindow(true)
, m_waitingForDidUpdateInWindowState(false)
+#if PLATFORM(MAC)
+ , m_exposedRectChangedTimer(this, &WebPageProxy::exposedRectChangedTimerFired)
+#endif
#if ENABLE(PAGE_VISIBILITY_API)
, m_visibilityState(PageVisibilityStateVisible)
#endif
@@ -629,6 +632,10 @@
m_drawingArea = nullptr;
+#if PLATFORM(MAC)
+ m_exposedRectChangedTimer.stop();
+#endif
+
m_process->send(Messages::WebPage::Close(), m_pageID);
m_process->removeWebPage(m_pageID);
m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (149760 => 149761)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-05-08 19:47:30 UTC (rev 149760)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2013-05-08 20:02:45 UTC (rev 149761)
@@ -388,6 +388,7 @@
void updateWindowIsVisible(bool windowIsVisible);
void windowAndViewFramesChanged(const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
void viewExposedRectChanged(const WebCore::FloatRect& exposedRect);
+ void exposedRectChangedTimerFired(WebCore::Timer<WebPageProxy>*);
void setMainFrameIsScrollable(bool);
void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd);
@@ -1267,6 +1268,12 @@
bool m_waitingForDidUpdateInWindowState;
+#if PLATFORM(MAC)
+ WebCore::Timer<WebPageProxy> m_exposedRectChangedTimer;
+ WebCore::FloatRect m_exposedRect;
+ WebCore::FloatRect m_lastSentExposedRect;
+#endif
+
#if PLATFORM(QT)
WTF::HashSet<RefPtr<QtRefCountedNetworkRequestData> > m_applicationSchemeRequests;
#endif
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (149760 => 149761)
--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2013-05-08 19:47:30 UTC (rev 149760)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2013-05-08 20:02:45 UTC (rev 149761)
@@ -155,9 +155,24 @@
if (!isValid())
return;
- process()->send(Messages::WebPage::ViewExposedRectChanged(exposedRect), m_pageID);
+ m_exposedRect = exposedRect;
+
+ if (!m_exposedRectChangedTimer.isActive())
+ m_exposedRectChangedTimer.startOneShot(0);
}
+void WebPageProxy::exposedRectChangedTimerFired(Timer<WebPageProxy>*)
+{
+ if (!isValid())
+ return;
+
+ if (m_exposedRect == m_lastSentExposedRect)
+ return;
+
+ process()->send(Messages::WebPage::ViewExposedRectChanged(m_exposedRect), m_pageID);
+ m_lastSentExposedRect = m_exposedRect;
+}
+
void WebPageProxy::setMainFrameIsScrollable(bool isScrollable)
{
if (!isValid())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes