<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[265533] trunk/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/265533">265533</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2020-08-11 16:07:51 -0700 (Tue, 11 Aug 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] Add Experimental Feature preference for SW VP9
https://bugs.webkit.org/show_bug.cgi?id=215043
<rdar://problem/66400034>

Reviewed by Beth Dakin.

* FeatureFlags/WebKit.plist:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
* Shared/WebPageCreationParameters.h:
* Shared/WebPreferences.yaml:
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultVP9SWDecoderEnabledOnBattery):
* Shared/WebPreferencesDefaultValues.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::enableVP9Decoder):
(WebKit::WebProcess::enableVP9SWDecoder):
* WebProcess/WebProcess.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitFeatureFlagsWebKitplist">trunk/Source/WebKit/FeatureFlags/WebKit.plist</a></li>
<li><a href="#trunkSourceWebKitSharedWebPageCreationParameterscpp">trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebPageCreationParametersh">trunk/Source/WebKit/Shared/WebPageCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKitSharedWebPreferencesyaml">trunk/Source/WebKit/Shared/WebPreferences.yaml</a></li>
<li><a href="#trunkSourceWebKitSharedWebPreferencesDefaultValuescpp">trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedWebPreferencesDefaultValuesh">trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagecpp">trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcesscpp">trunk/Source/WebKit/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcessh">trunk/Source/WebKit/WebProcess/WebProcess.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/ChangeLog       2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2020-08-11  Jer Noble  <jer.noble@apple.com>
+
+        [Mac] Add Experimental Feature preference for SW VP9
+        https://bugs.webkit.org/show_bug.cgi?id=215043
+        <rdar://problem/66400034>
+
+        Reviewed by Beth Dakin.
+
+        * FeatureFlags/WebKit.plist:
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode const):
+        * Shared/WebPageCreationParameters.h:
+        * Shared/WebPreferences.yaml:
+        * Shared/WebPreferencesDefaultValues.cpp:
+        (WebKit::defaultVP9SWDecoderEnabledOnBattery):
+        * Shared/WebPreferencesDefaultValues.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::creationParameters):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_limitsNavigationsToAppBoundDomains):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::enableVP9Decoder):
+        (WebKit::WebProcess::enableVP9SWDecoder):
+        * WebProcess/WebProcess.h:
+
</ins><span class="cx"> 2020-08-11  Brady Eidson  <beidson@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add a "use stored credentials" setting to WKWebView.
</span></span></pre></div>
<a id="trunkSourceWebKitFeatureFlagsWebKitplist"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/FeatureFlags/WebKit.plist (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/FeatureFlags/WebKit.plist    2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/FeatureFlags/WebKit.plist       2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -52,6 +52,11 @@
</span><span class="cx">         <key>Enabled</key>
</span><span class="cx">         <true/>
</span><span class="cx">     </dict>
</span><ins>+    <key>sw_vp9_decoder_on_battery</key>
+    <dict>
+        <key>Enabled</key>
+        <false/>
+    </dict>
</ins><span class="cx">     <key>webm_parser</key>
</span><span class="cx">     <dict>
</span><span class="cx">         <key>Enabled</key>
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPageCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp    2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -154,6 +154,7 @@
</span><span class="cx">     encoder << shouldCaptureDisplayInUIProcess;
</span><span class="cx">     encoder << shouldRenderCanvasInGPUProcess;
</span><span class="cx">     encoder << shouldEnableVP9Decoder;
</span><ins>+    encoder << shouldEnableVP9SWDecoder;
</ins><span class="cx">     encoder << needsInAppBrowserPrivacyQuirks;
</span><span class="cx">     encoder << limitsNavigationsToAppBoundDomains;
</span><span class="cx">     encoder << shouldRelaxThirdPartyCookieBlocking;
</span><span class="lines">@@ -496,6 +497,9 @@
</span><span class="cx">     if (!decoder.decode(parameters.shouldEnableVP9Decoder))
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(parameters.shouldEnableVP9SWDecoder))
+        return WTF::nullopt;
+
</ins><span class="cx">     if (!decoder.decode(parameters.needsInAppBrowserPrivacyQuirks))
</span><span class="cx">         return WTF::nullopt;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPageCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h   2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h      2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -227,6 +227,7 @@
</span><span class="cx">     bool shouldCaptureDisplayInUIProcess { false };
</span><span class="cx">     bool shouldRenderCanvasInGPUProcess { false };
</span><span class="cx">     bool shouldEnableVP9Decoder { false };
</span><ins>+    bool shouldEnableVP9SWDecoder { false };
</ins><span class="cx">     bool needsInAppBrowserPrivacyQuirks { false };
</span><span class="cx">     bool limitsNavigationsToAppBoundDomains { false };
</span><span class="cx">     bool canUseCredentialStorage { true };
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPreferencesyaml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPreferences.yaml   2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml      2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -677,6 +677,15 @@
</span><span class="cx">   category: experimental
</span><span class="cx">   condition: ENABLE(VP9)
</span><span class="cx"> 
</span><ins>+VP9SWDecoderEnabledOnBattery:
+  type: bool
+  defaultValue: defaultVP9SWDecoderEnabledOnBattery()
+  webcoreBinding: none
+  humanReadableName: "VP9 SW decoder on battery"
+  humanReadableDescription: "Enable VP9 SW decoder on battery"
+  category: experimental
+  condition: ENABLE(VP9)
+
</ins><span class="cx"> WebMParserEnabled:
</span><span class="cx">   type: bool
</span><span class="cx">   defaultValue: defaultWebMParserEnabled()
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPreferencesDefaultValuescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp       2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp  2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -254,6 +254,17 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(VP9)
+bool defaultVP9SWDecoderEnabledOnBattery()
+{
+#if HAVE(SYSTEM_FEATURE_FLAGS)
+    return isFeatureFlagEnabled("SW_vp9_decoder_on_battery");
+#endif
+
+    return false;
+}
+#endif
+
</ins><span class="cx"> #if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
</span><span class="cx"> bool defaultWebMParserEnabled()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitSharedWebPreferencesDefaultValuesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h 2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h    2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -364,6 +364,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VP9)
</span><span class="cx"> bool defaultVP9DecoderEnabled();
</span><ins>+bool defaultVP9SWDecoderEnabledOnBattery();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE) && ENABLE(VP9)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -211,6 +211,7 @@
</span><span class="cx"> #include "VideoFullscreenManagerProxyMessages.h"
</span><span class="cx"> #include <WebCore/AttributedString.h>
</span><span class="cx"> #include <WebCore/RunLoopObserver.h>
</span><ins>+#include <WebCore/SystemBattery.h>
</ins><span class="cx"> #include <WebCore/TextIndicatorWindow.h>
</span><span class="cx"> #include <wtf/MachSendRight.h>
</span><span class="cx"> #include <wtf/cocoa/Entitlements.h>
</span><span class="lines">@@ -7869,6 +7870,9 @@
</span><span class="cx">     parameters.shouldCaptureVideoInGPUProcess = preferences().captureVideoInGPUProcessEnabled();
</span><span class="cx">     parameters.shouldRenderCanvasInGPUProcess = preferences().renderCanvasInGPUProcessEnabled();
</span><span class="cx">     parameters.shouldEnableVP9Decoder = preferences().vp9DecoderEnabled();
</span><ins>+#if PLATFORM(COCOA)
+    parameters.shouldEnableVP9SWDecoder = preferences().vp9DecoderEnabled() && (!WebCore::systemHasBattery() || preferences().vp9SWDecoderEnabledOnBattery());
+#endif
</ins><span class="cx">     parameters.shouldCaptureDisplayInUIProcess = m_process->processPool().configuration().shouldCaptureDisplayInUIProcess();
</span><span class="cx">     parameters.limitsNavigationsToAppBoundDomains = m_limitsNavigationsToAppBoundDomains;
</span><span class="cx">     parameters.shouldRelaxThirdPartyCookieBlocking = m_configuration->shouldRelaxThirdPartyCookieBlocking();
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp       2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp  2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -780,6 +780,9 @@
</span><span class="cx">     if (parameters.shouldEnableVP9Decoder)
</span><span class="cx">         WebProcess::singleton().enableVP9Decoder();
</span><span class="cx"> 
</span><ins>+    if (parameters.shouldEnableVP9SWDecoder)
+        WebProcess::singleton().enableVP9SWDecoder();
+
</ins><span class="cx">     m_page->setCanUseCredentialStorage(parameters.canUseCredentialStorage);
</span><span class="cx"> 
</span><span class="cx">     updateThrottleState();
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.cpp    2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp       2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -1967,6 +1967,15 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebProcess::enableVP9SWDecoder()
+{
+    if (m_vp9SWDecoderEnabled)
+        return;
+
+    m_vp9SWDecoderEnabled = true;
+    LibWebRTCProvider::registerWebKitVP9Decoder();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #undef RELEASE_LOG_SESSION_ID
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (265532 => 265533)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.h      2020-08-11 23:05:40 UTC (rev 265532)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2020-08-11 23:07:51 UTC (rev 265533)
</span><span class="lines">@@ -333,6 +333,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void enableVP9Decoder();
</span><ins>+    void enableVP9SWDecoder();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void willWriteToPasteboardAsynchronously(const String& pasteboardName);
</span><span class="lines">@@ -660,6 +661,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_useGPUProcessForMedia { false };
</span><span class="cx">     bool m_vp9DecoderEnabled { false };
</span><ins>+    bool m_vp9SWDecoderEnabled { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>