Title: [276267] trunk
- Revision
- 276267
- Author
- [email protected]
- Date
- 2021-04-19 11:55:04 -0700 (Mon, 19 Apr 2021)
Log Message
SVG Images launch the GPUProcess unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=224770
Reviewed by Eric Carlson.
Source/WebCore:
Make sure MediaPlayer::supportsType() returns early for MIME types that can definitely
not be media, to avoid launch the GPUProcess unnecessarily.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::supportsType):
Tools:
Add API test coverage.
* TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (276266 => 276267)
--- trunk/Source/WebCore/ChangeLog 2021-04-19 18:52:25 UTC (rev 276266)
+++ trunk/Source/WebCore/ChangeLog 2021-04-19 18:55:04 UTC (rev 276267)
@@ -1,3 +1,16 @@
+2021-04-19 Chris Dumez <[email protected]>
+
+ SVG Images launch the GPUProcess unnecessarily
+ https://bugs.webkit.org/show_bug.cgi?id=224770
+
+ Reviewed by Eric Carlson.
+
+ Make sure MediaPlayer::supportsType() returns early for MIME types that can definitely
+ not be media, to avoid launch the GPUProcess unnecessarily.
+
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::supportsType):
+
2021-04-19 Manuel Rego Casasnovas <[email protected]>
[selectors] Script focus and :focus-visible
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (276266 => 276267)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2021-04-19 18:52:25 UTC (rev 276266)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2021-04-19 18:55:04 UTC (rev 276267)
@@ -1039,6 +1039,10 @@
if (containerType == applicationOctetStream())
return SupportsType::IsNotSupported;
+ auto lowercaseType = containerType.convertToASCIILowercase();
+ if (!lowercaseType.startsWith("video/") && !lowercaseType.startsWith("audio/") && !lowercaseType.startsWith("application/"))
+ return SupportsType::IsNotSupported;
+
const MediaPlayerFactory* engine = bestMediaEngineForSupportParameters(parameters);
if (!engine)
return SupportsType::IsNotSupported;
Modified: trunk/Tools/ChangeLog (276266 => 276267)
--- trunk/Tools/ChangeLog 2021-04-19 18:52:25 UTC (rev 276266)
+++ trunk/Tools/ChangeLog 2021-04-19 18:55:04 UTC (rev 276267)
@@ -1,3 +1,15 @@
+2021-04-19 Chris Dumez <[email protected]>
+
+ SVG Images launch the GPUProcess unnecessarily
+ https://bugs.webkit.org/show_bug.cgi?id=224770
+
+ Reviewed by Eric Carlson.
+
+ Add API test coverage.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm:
+ (TEST):
+
2021-04-19 Philippe Normand <[email protected]>
Unreviewed, WPE Minibrowser build warning fix.
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm (276266 => 276267)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm 2021-04-19 18:52:25 UTC (rev 276266)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/GPUProcess.mm 2021-04-19 18:55:04 UTC (rev 276267)
@@ -233,6 +233,22 @@
EXPECT_EQ([configuration.get().processPool _gpuProcessIdentifier], 0);
}
+TEST(GPUProcess, OnlyLaunchesGPUProcessWhenNecessarySVG)
+{
+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ WKPreferencesSetBoolValueForKeyForTesting((__bridge WKPreferencesRef)[configuration preferences], true, WKStringCreateWithUTF8CString("UseGPUProcessForMediaEnabled"));
+ WKPreferencesSetBoolValueForKeyForTesting((__bridge WKPreferencesRef)[configuration preferences], true, WKStringCreateWithUTF8CString("CaptureVideoInGPUProcessEnabled"));
+ WKPreferencesSetBoolValueForKeyForTesting((__bridge WKPreferencesRef)[configuration preferences], true, WKStringCreateWithUTF8CString("UseGPUProcessForCanvasRenderingEnabled"));
+ WKPreferencesSetBoolValueForKeyForTesting((__bridge WKPreferencesRef)[configuration preferences], false, WKStringCreateWithUTF8CString("UseGPUProcessForDOMRenderingEnabled"));
+
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 400, 400) configuration:configuration.get()]);
+ [webView synchronouslyLoadHTMLString:@"<img src=''></img>"];
+
+ TestWebKitAPI::Util::spinRunLoop(10);
+
+ EXPECT_EQ([configuration.get().processPool _gpuProcessIdentifier], 0);
+}
+
TEST(GPUProcess, CrashWhilePlayingVideo)
{
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes