Allow overriding the waitForDidUpdateViewState timeout
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2015 00:14:00 +0000 (00:14 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2015 00:14:00 +0000 (00:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145230
<rdar://problem/20990162>

Reviewed by Darin Adler.

* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState):
Use the value from NSUserDefaults, if it exists.
We'll only check once, so changing the default requires a restart of the UI process.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm

index 91f5b42..3124eaf 100644 (file)
@@ -1,3 +1,16 @@
+2015-05-20  Tim Horton  <timothy_horton@apple.com>
+
+        Allow overriding the waitForDidUpdateViewState timeout
+        https://bugs.webkit.org/show_bug.cgi?id=145230
+        <rdar://problem/20990162>
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState):
+        Use the value from NSUserDefaults, if it exists.
+        We'll only check once, so changing the default requires a restart of the UI process.
+
 2015-05-20  Anders Carlsson  <andersca@apple.com>
 
         Make sure we always have a process pool to perform data store operations with
index 301681f..e1abffa 100644 (file)
@@ -393,11 +393,16 @@ void RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay(double)
 
 void RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateViewState()
 {
+    static std::chrono::milliseconds viewStateUpdateTimeout = [] {
+        if (id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"WebKitOverrideViewStateUpdateTimeout"])
+            return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>([value doubleValue]));
+
 #if PLATFORM(IOS)
-    auto viewStateUpdateTimeout = std::chrono::milliseconds(500);
+        return std::chrono::milliseconds(500);
 #else
-    auto viewStateUpdateTimeout = std::chrono::milliseconds(250);
+        return std::chrono::milliseconds(250);
 #endif
+    }();
     m_webPageProxy.process().connection()->waitForAndDispatchImmediately<Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree>(m_webPageProxy.pageID(), viewStateUpdateTimeout, InterruptWaitingIfSyncMessageArrives);
 }