<!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>[279796] 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/279796">279796</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2021-07-09 14:54:43 -0700 (Fri, 09 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] Allow the UIProcess to set logging parameters in the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=227822

Reviewed by Eric Carlson.

For release builds, logLevelString() will return an empty string. Instead, do the same thing
for GPUProcessProxy as we do for WebProcessPool: have a platform-specific initialization
function that, for Cocoa ports, reads log strings from NSUserDefaults.

Drive-by fix: Include <optional> in WKContentPicker.h to work around a unified build error.

* SourcesCocoa.txt:
* UIProcess/Cocoa/GPUProcessProxyCocoa.mm: Added.
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/Cocoa/WKContactPicker.h:
* UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::GPUProcessProxy):
(WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
* UIProcess/GPU/GPUProcessProxy.h:
* WebKit.xcodeproj/project.pbxproj:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSourcesCocoatxt">trunk/Source/WebKit/SourcesCocoa.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessCocoaWKContactPickerh">trunk/Source/WebKit/UIProcess/Cocoa/WKContactPicker.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessGPUGPUProcessProxycpp">trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessGPUGPUProcessProxyh">trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitUIProcessCocoaGPUProcessProxyCocoamm">trunk/Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (279795 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-07-09 21:47:15 UTC (rev 279795)
+++ trunk/Source/WebKit/ChangeLog       2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2021-07-09  Jer Noble  <jer.noble@apple.com>
+
+        [Cocoa] Allow the UIProcess to set logging parameters in the GPUProcess
+        https://bugs.webkit.org/show_bug.cgi?id=227822
+
+        Reviewed by Eric Carlson.
+
+        For release builds, logLevelString() will return an empty string. Instead, do the same thing
+        for GPUProcessProxy as we do for WebProcessPool: have a platform-specific initialization
+        function that, for Cocoa ports, reads log strings from NSUserDefaults.
+
+        Drive-by fix: Include <optional> in WKContentPicker.h to work around a unified build error.
+
+        * SourcesCocoa.txt:
+        * UIProcess/Cocoa/GPUProcessProxyCocoa.mm: Added.
+        (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
+        * UIProcess/Cocoa/WKContactPicker.h:
+        * UIProcess/GPU/GPUProcessProxy.cpp:
+        (WebKit::GPUProcessProxy::GPUProcessProxy):
+        (WebKit::GPUProcessProxy::platformInitializeGPUProcessParameters):
+        * UIProcess/GPU/GPUProcessProxy.h:
+        * WebKit.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2021-07-09  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Validate keys in ResourceLoadStatisticsDatabaseStore::findNotVeryPrevalentResources() before using them with HashMap
</span></span></pre></div>
<a id="trunkSourceWebKitSourcesCocoatxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesCocoa.txt (279795 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesCocoa.txt     2021-07-09 21:47:15 UTC (rev 279795)
+++ trunk/Source/WebKit/SourcesCocoa.txt        2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -395,6 +395,7 @@
</span><span class="cx"> UIProcess/Cocoa/DownloadProxyMapCocoa.mm
</span><span class="cx"> UIProcess/Cocoa/FindClient.mm
</span><span class="cx"> UIProcess/Cocoa/FullscreenClient.mm
</span><ins>+UIProcess/Cocoa/GPUProcessProxyCocoa.mm
</ins><span class="cx"> UIProcess/Cocoa/GlobalFindInPageState.mm
</span><span class="cx"> UIProcess/Cocoa/IconLoadingDelegate.mm
</span><span class="cx"> UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaGPUProcessProxyCocoammfromrev279795trunkSourceWebKitUIProcessCocoaWKContactPickerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm (from rev 279795, trunk/Source/WebKit/UIProcess/Cocoa/WKContactPicker.h) (0 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm                              (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/GPUProcessProxyCocoa.mm 2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GPUProcessProxy.h"
+
+#if ENABLE(GPU_PROCESS)
+
+#include "GPUProcessCreationParameters.h"
+
+namespace WebKit {
+
+void GPUProcessProxy::platformInitializeGPUProcessParameters(GPUProcessCreationParameters& parameters)
+{
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+    parameters.webCoreLoggingChannels = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebCoreLogging"];
+    parameters.webKitLoggingChannels = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebKit2Logging"];
+#endif
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaWKContactPickerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKContactPicker.h (279795 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/WKContactPicker.h    2021-07-09 21:47:15 UTC (rev 279795)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKContactPicker.h       2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(CONTACTSUI)
</span><span class="cx"> 
</span><ins>+#include <optional>
</ins><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> 
</span><span class="cx"> @class WKWebView;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessGPUGPUProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp (279795 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp    2021-07-09 21:47:15 UTC (rev 279795)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp       2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -170,10 +170,7 @@
</span><span class="cx">         parameters.dynamicMachExtensionHandles = SandboxExtension::createHandlesForMachLookup(nonBrowserServices(), std::nullopt);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-    parameters.webCoreLoggingChannels = WebCore::logLevelString();
-    parameters.webKitLoggingChannels = WebKit::logLevelString();
-#endif
</del><ins>+    platformInitializeGPUProcessParameters(parameters);
</ins><span class="cx"> 
</span><span class="cx">     // Initialize the GPU process.
</span><span class="cx">     send(Messages::GPUProcess::InitializeGPUProcess(parameters), 0);
</span><span class="lines">@@ -604,6 +601,16 @@
</span><span class="cx">     gpuProcessExited(GPUProcessTerminationReason::Unresponsive);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(COCOA)
+void GPUProcessProxy::platformInitializeGPUProcessParameters(GPUProcessCreationParameters& parameters)
+{
+#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
+    parameters.webCoreLoggingChannels = WebCore::logLevelString();
+    parameters.webKitLoggingChannels = WebKit::logLevelString();
+#endif
+}
+#endif
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #undef MESSAGE_CHECK
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessGPUGPUProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h (279795 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h      2021-07-09 21:47:15 UTC (rev 279795)
+++ trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h 2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -130,6 +130,8 @@
</span><span class="cx">     void didCreateContextForVisibilityPropagation(WebPageProxyIdentifier, WebCore::PageIdentifier, LayerHostingContextID);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void platformInitializeGPUProcessParameters(GPUProcessCreationParameters&);
+
</ins><span class="cx">     ProcessThrottler m_throttler;
</span><span class="cx">     ProcessThrottler::ActivityVariant m_activityFromWebProcesses;
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (279795 => 279796)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj     2021-07-09 21:47:15 UTC (rev 279795)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2021-07-09 21:54:43 UTC (rev 279796)
</span><span class="lines">@@ -5772,6 +5772,7 @@
</span><span class="cx">          CDAC20F423FC383A0021DEE3 /* RemoteCDMProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCDMProxyMessages.h; sourceTree = "<group>"; };
</span><span class="cx">          CDAC20F523FC383B0021DEE3 /* RemoteCDMInstanceProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteCDMInstanceProxyMessageReceiver.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CDAC20F623FC383B0021DEE3 /* RemoteCDMInstanceProxyMessagesReplies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCDMInstanceProxyMessagesReplies.h; sourceTree = "<group>"; };
</span><ins>+               CDB2A1ED2697925C006B235C /* GPUProcessProxyCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUProcessProxyCocoa.mm; sourceTree = "<group>"; };
</ins><span class="cx">           CDBB49F4240D8AC60017C292 /* RemoteAudioSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteAudioSession.h; sourceTree = "<group>"; };
</span><span class="cx">          CDBB49F5240D8AC60017C292 /* RemoteAudioSession.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteAudioSession.cpp; sourceTree = "<group>"; };
</span><span class="cx">          CDBB49F6240D8C950017C292 /* RemoteAudioSessionProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteAudioSessionProxy.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -7056,6 +7057,7 @@
</span><span class="cx">                          CD78E1121DB7D7ED0014A2DE /* FullscreenClient.mm */,
</span><span class="cx">                          2E2B3BA421D4879000538EDF /* GlobalFindInPageState.h */,
</span><span class="cx">                          2E2B3BA321D4879000538EDF /* GlobalFindInPageState.mm */,
</span><ins>+                               CDB2A1ED2697925C006B235C /* GPUProcessProxyCocoa.mm */,
</ins><span class="cx">                           51C0C9721DDD74F00032CAD3 /* IconLoadingDelegate.h */,
</span><span class="cx">                          51C0C9731DDD74F00032CAD3 /* IconLoadingDelegate.mm */,
</span><span class="cx">                          7A821F4B1E2F664800604577 /* LegacyCustomProtocolManagerClient.h */,
</span></span></pre>
</div>
</div>

</body>
</html>