Title: [275341] trunk/Source/WebKit
Revision
275341
Author
pan...@apple.com
Date
2021-03-31 19:31:17 -0700 (Wed, 31 Mar 2021)

Log Message

Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler can exceed the soft thread limit when opening multiple inspectors simultaneously.
https://bugs.webkit.org/show_bug.cgi?id=223958

Reviewed by BJ Burg.

In engineering builds, the Web Inspector is loaded as hundreds of separate resources instead of the handful of
minified sources used for released builds. When two Web Inspector windows are opened their loads can overlap
and it is possible for the sum total of file load operations to exceed the dispatch soft thread limit. To
resolve this, we set a sensible limit to the number of simultaneous inspector loading operations. A higher
number of allowed concurrent operations yielded no noticeable increase in load speeds.

* UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
(-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (275340 => 275341)


--- trunk/Source/WebKit/ChangeLog	2021-04-01 02:30:23 UTC (rev 275340)
+++ trunk/Source/WebKit/ChangeLog	2021-04-01 02:31:17 UTC (rev 275341)
@@ -1,3 +1,19 @@
+2021-03-31  Patrick Angle  <pan...@apple.com>
+
+        Web Inspector: [Cocoa] WKInspectorResourceURLSchemeHandler can exceed the soft thread limit when opening multiple inspectors simultaneously.
+        https://bugs.webkit.org/show_bug.cgi?id=223958
+
+        Reviewed by BJ Burg.
+
+        In engineering builds, the Web Inspector is loaded as hundreds of separate resources instead of the handful of
+        minified sources used for released builds. When two Web Inspector windows are opened their loads can overlap
+        and it is possible for the sum total of file load operations to exceed the dispatch soft thread limit. To
+        resolve this, we set a sensible limit to the number of simultaneous inspector loading operations. A higher
+        number of allowed concurrent operations yielded no noticeable increase in load speeds.
+
+        * UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm:
+        (-[WKInspectorResourceURLSchemeHandler webView:startURLSchemeTask:]):
+
 2021-03-31  Wenson Hsieh  <wenson_hs...@apple.com>
 
         List of extents should be bounds-checked when iterating display list items

Modified: trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm (275340 => 275341)


--- trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm	2021-04-01 02:30:23 UTC (rev 275340)
+++ trunk/Source/WebKit/UIProcess/Inspector/mac/WKInspectorResourceURLSchemeHandler.mm	2021-04-01 02:31:17 UTC (rev 275341)
@@ -58,6 +58,10 @@
         _operationQueue = adoptNS([[NSOperationQueue alloc] init]);
         _operationQueue.get().underlyingQueue = dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0);
         _operationQueue.get().qualityOfService = NSOperationQualityOfServiceUserInteractive;
+
+        // The default value (NSOperationQueueDefaultMaxConcurrentOperationCount) results in a large number of threads
+        // that can exceed the soft limit if two Web Inspector instances are being loaded simultaneously.
+        _operationQueue.get().maxConcurrentOperationCount = 4;
     }
 
     NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to