Add a runtime setting for media in the GPU process
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2019 22:56:46 +0000 (22:56 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2019 22:56:46 +0000 (22:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204801
<rdar://problem/57596199>

Reviewed by Jer Noble.

Source/WebCore:

* page/Settings.yaml:

Source/WebKit:

* Shared/WebPreferences.yaml:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences outOfProcessMediaEnabled]):
(-[WebPreferences setOutOfProcessMediaEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

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

Source/WebCore/ChangeLog
Source/WebCore/page/Settings.yaml
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm

index f9089c8..5ba0e01 100644 (file)
@@ -1,3 +1,13 @@
+2019-12-03  Eric Carlson  <eric.carlson@apple.com>
+
+        Add a runtime setting for media in the GPU process
+        https://bugs.webkit.org/show_bug.cgi?id=204801
+        <rdar://problem/57596199>
+
+        Reviewed by Jer Noble.
+
+        * page/Settings.yaml:
+
 2019-12-03  Jer Noble  <jer.noble@apple.com>
 
         Experimental support for HDR media query
index a01d2f6..29b4d8c 100644 (file)
@@ -320,6 +320,9 @@ shouldDisplayTextDescriptions:
 genericCueAPIEnabled:
     initial: false
     conditional: VIDEO_TRACK
+outOfProcessMediaEnabled:
+    initial: false
+    conditional: VIDEO
 scrollingCoordinatorEnabled:
   initial: false
 scrollingTreeIncludesFrames:
index 93076d7..6d59f5f 100644 (file)
@@ -1,3 +1,15 @@
+2019-12-03  Eric Carlson  <eric.carlson@apple.com>
+
+        Add a runtime setting for media in the GPU process
+        https://bugs.webkit.org/show_bug.cgi?id=204801
+        <rdar://problem/57596199>
+
+        Reviewed by Jer Noble.
+
+        * Shared/WebPreferences.yaml:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+
 2019-12-03  Per Arne Vollan  <pvollan@apple.com>
 
         Unreviewed assertion fix for older macOS versions after r253011.
index cbb8f56..485e851 100644 (file)
@@ -1837,6 +1837,15 @@ RemotePlaybackEnabled:
   humanReadableName: "Remote Playback API"
   humanReadableDescription: "Enable Remote Playback API"
 
+OutOfProcessMediaEnabled:
+    type: bool
+    defaultValue: false
+    condition: ENABLE(VIDEO)
+    humanReadableName: "Media in GPU process"
+    humanReadableDescription: "Do all media loading and playback in the GPU process"
+    category: experimental
+    webcoreName: outOfProcessMediaEnabled
+
 # Deprecated
 
 ICECandidateFilteringEnabled:
index f3c800c..083ae74 100644 (file)
@@ -247,6 +247,15 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page
     }
 #endif
 
+#if ENABLE(VIDEO)
+    if (preference == "WebKitOutOfProcessMediaEnabled") {
+        WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::imageControlsEnabledKey(), enabled);
+        for (auto* page : pages)
+            page->settings().setOutOfProcessMediaEnabled(enabled);
+        return;
+    }
+#endif
+
     if (preference == "WebKitIsSecureContextAttributeEnabled") {
         WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::isSecureContextAttributeEnabledKey(), enabled);
         RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(enabled);
index ce5b163..817d969 100644 (file)
@@ -1,3 +1,20 @@
+2019-12-03  Eric Carlson  <eric.carlson@apple.com>
+
+        Add a runtime setting for media in the GPU process
+        https://bugs.webkit.org/show_bug.cgi?id=204801
+        <rdar://problem/57596199>
+
+        Reviewed by Jer Noble.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences outOfProcessMediaEnabled]):
+        (-[WebPreferences setOutOfProcessMediaEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2019-12-03  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Add a runtime flag for Web Animations composite operations
index 8181ef5..2afca77 100644 (file)
 #define WebKitEncryptedMediaAPIEnabledKey @"WebKitEncryptedMediaAPIEnabled"
 #define WebKitPictureInPictureAPIEnabledKey @"WebKitPictureInPictureAPIEnabled"
 #define WebKitGenericCueAPIEnabledKey @"WebKitGenericCueAPIEnabled"
+#define WebKitOutOfProcessMediaEnabledKey @"WebKitOutOfProcessMediaEnabled"
 #define WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey @"WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallback"
 #define WebKitInspectorAdditionsEnabledPreferenceKey @"WebKitInspectorAdditionsEnabled"
 #define WebKitAccessibilityObjectModelEnabledPreferenceKey @"WebKitAccessibilityObjectModelEnabled"
index 4ec3aaf..a859f4c 100644 (file)
@@ -617,6 +617,10 @@ public:
         @NO, WebKitGenericCueAPIEnabledKey,
 #endif
 
+#if ENABLE(VIDEO)
+        @NO, WebKitOutOfProcessMediaEnabledKey,
+#endif
+
 #if ENABLE(MEDIA_STREAM)
         @NO, WebKitMockCaptureDevicesEnabledPreferenceKey,
         @YES, WebKitMockCaptureDevicesPromptEnabledPreferenceKey,
@@ -3368,6 +3372,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitGenericCueAPIEnabledKey];
 }
 
+- (BOOL)outOfProcessMediaEnabled
+{
+    return [self _boolValueForKey:WebKitOutOfProcessMediaEnabledKey];
+}
+
+- (void)setOutOfProcessMediaEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitOutOfProcessMediaEnabledKey];
+}
+
 - (BOOL)viewportFitEnabled
 {
     return [self _boolValueForKey:WebKitViewportFitEnabledPreferenceKey];
index 5815cb0..a20cc60 100644 (file)
@@ -649,6 +649,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
 @property (nonatomic) BOOL encryptedMediaAPIEnabled;
 @property (nonatomic) BOOL pictureInPictureAPIEnabled;
 @property (nonatomic) BOOL genericCueAPIEnabled;
+@property (nonatomic) BOOL outOfProcessMediaEnabled;
 @property (nonatomic) BOOL viewportFitEnabled;
 @property (nonatomic) BOOL constantPropertiesEnabled;
 @property (nonatomic) BOOL colorFilterEnabled;
index 4fd9a3d..bdddfe4 100644 (file)
@@ -3209,6 +3209,10 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setGenericCueAPIEnabled(preferences.genericCueAPIEnabled);
 #endif
 
+#if ENABLE(VIDEO)
+    settings.setOutOfProcessMediaEnabled(preferences.outOfProcessMediaEnabled);
+#endif
+
     RuntimeEnabledFeatures::sharedFeatures().setInspectorAdditionsEnabled(preferences.inspectorAdditionsEnabled);
 
     settings.setAllowMediaContentTypesRequiringHardwareSupportAsFallback(preferences.allowMediaContentTypesRequiringHardwareSupportAsFallback);