theverge.com burning 100% CPU on iPad (due to window.screenX/Y)
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Apr 2015 00:25:39 +0000 (00:25 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Apr 2015 00:25:39 +0000 (00:25 +0000)
<https://webkit.org/b/144175>
<rdar://problem/20694585>

Reviewed by Anders Carlsson.

Return an empty window rect on iOS WK2 builds. This avoids sending a synchronous
IPC request to the UI process that would give the same result, but spend way
more time and CPU cycles to do so.

With this change, theverge.com CPU usage goes from 100% to ~20% when idle.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::windowRect):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183299 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

index 8df347d..89387dd 100644 (file)
@@ -1,3 +1,20 @@
+2015-04-24  Andreas Kling  <akling@apple.com>
+
+        theverge.com burning 100% CPU on iPad (due to window.screenX/Y)
+        <https://webkit.org/b/144175>
+        <rdar://problem/20694585>
+
+        Reviewed by Anders Carlsson.
+
+        Return an empty window rect on iOS WK2 builds. This avoids sending a synchronous
+        IPC request to the UI process that would give the same result, but spend way
+        more time and CPU cycles to do so.
+
+        With this change, theverge.com CPU usage goes from 100% to ~20% when idle.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::windowRect):
+
 2015-04-24  Brent Fulgham  <bfulgham@apple.com>
 
         TextIndicator for embedded PDFs is slightly offset
index b515f11..17a1ce7 100644 (file)
@@ -129,7 +129,10 @@ void WebChromeClient::setWindowRect(const FloatRect& windowFrame)
 
 FloatRect WebChromeClient::windowRect()
 {
-#if PLATFORM(COCOA)
+#if PLATFORM(IOS)
+    return FloatRect();
+#else
+#if PLATFORM(MAC)
     if (m_page->hasCachedWindowFrame())
         return m_page->windowFrameInUnflippedScreenCoordinates();
 #endif
@@ -140,6 +143,7 @@ FloatRect WebChromeClient::windowRect()
         return FloatRect();
 
     return newWindowFrame;
+#endif
 }
 
 FloatRect WebChromeClient::pageRect()