<!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>[247521] trunk/Source</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/247521">247521</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2019-07-17 10:50:45 -0700 (Wed, 17 Jul 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make ANGLE work inside WebKit2's sandbox
https://bugs.webkit.org/show_bug.cgi?id=199844

Patch by Kenneth Russell <kbr@chromium.org> on 2019-07-17
Reviewed by Alex Christensen.

Source/ThirdParty/ANGLE:

Cherry-pick fix for crbug.com/angleproject/3383 to eliminate use
of deprecated API in SystemInfo_mac.mm.

* BUILD.gn:
* src/gpu_info_util/SystemInfo.cpp:
(angle::FindActiveGPU):
(angle::PrintSystemInfo):
(angle::FindPrimaryGPU): Deleted.
* src/gpu_info_util/SystemInfo.h:
* src/gpu_info_util/SystemInfo_internal.h:
* src/gpu_info_util/SystemInfo_linux.cpp:
(angle::GetSystemInfo):
* src/gpu_info_util/SystemInfo_mac.mm:
(angle::GetSystemInfo):
* src/gpu_info_util/SystemInfo_win.cpp:
(angle::GetSystemInfo):
* src/tests/BUILD.gn:
* src/tests/test_expectations/GPUTestConfig.cpp:
* src/tests/test_utils/angle_test_instantiate.cpp:
(angle::IsConfigWhitelisted):

Source/WebCore:

Fix missing #import introduced at the last minute while removing
some debugging code in the last patch.

Tested with San Angeles WebGL demo and some conformance tests.

* platform/graphics/cocoa/WebGLLayer.mm:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEBUILDgn">trunk/Source/ThirdParty/ANGLE/BUILD.gn</a></li>
<li><a href="#trunkSourceThirdPartyANGLEChangeLog">trunk/Source/ThirdParty/ANGLE/ChangeLog</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfocpp">trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfoh">trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_internalh">trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_internal.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_linuxcpp">trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_linux.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_macmm">trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_wincpp">trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_win.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrctestsBUILDgn">trunk/Source/ThirdParty/ANGLE/src/tests/BUILD.gn</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcteststest_expectationsGPUTestConfigcpp">trunk/Source/ThirdParty/ANGLE/src/tests/test_expectations/GPUTestConfig.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcteststest_utilsangle_test_instantiatecpp">trunk/Source/ThirdParty/ANGLE/src/tests/test_utils/angle_test_instantiate.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaWebGLLayermm">trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceThirdPartyANGLEBUILDgn"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/BUILD.gn (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/BUILD.gn   2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/BUILD.gn      2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -289,7 +289,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> angle_static_library("angle_gpu_info_util") {
</span><del>-  public_configs += [ ":angle_gpu_info_util_config" ]
</del><ins>+  public_configs += [
+    ":angle_gpu_info_util_config",
+    ":angle_backend_config",
+  ]
</ins><span class="cx">   public_deps = [
</span><span class="cx">     ":angle_common",
</span><span class="cx">   ]
</span><span class="lines">@@ -305,7 +308,7 @@
</span><span class="cx">   if (is_win) {
</span><span class="cx">     sources += libangle_gpu_info_util_win_sources
</span><span class="cx">     libs += [ "setupapi.lib" ]
</span><del>-    defines += [ "GPU_INFO_USE_SETUPAPI" ]
</del><ins>+    libs += [ "dxgi.lib" ]
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   if (is_linux || is_fuchsia) {
</span><span class="lines">@@ -443,14 +446,11 @@
</span><span class="cx">   ]
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-config("libANGLE_config") {
-  cflags = []
</del><ins>+config("angle_backend_config") {
</ins><span class="cx">   defines = []
</span><del>-  libs = []
-  ldflags = []
</del><ins>+
</ins><span class="cx">   if (angle_enable_d3d9) {
</span><span class="cx">     defines += [ "ANGLE_ENABLE_D3D9" ]
</span><del>-    ldflags += [ "/DELAYLOAD:d3d9.dll" ]
</del><span class="cx">   }
</span><span class="cx">   if (angle_enable_d3d11) {
</span><span class="cx">     defines += [ "ANGLE_ENABLE_D3D11" ]
</span><span class="lines">@@ -473,6 +473,16 @@
</span><span class="cx">   if (angle_enable_null) {
</span><span class="cx">     defines += [ "ANGLE_ENABLE_NULL" ]
</span><span class="cx">   }
</span><ins>+}
+
+config("libANGLE_config") {
+  cflags = []
+  defines = []
+  libs = []
+  ldflags = []
+  if (angle_enable_d3d9) {
+    ldflags += [ "/DELAYLOAD:d3d9.dll" ]
+  }
</ins><span class="cx">   defines += [ "LIBANGLE_IMPLEMENTATION" ]
</span><span class="cx"> 
</span><span class="cx">   if (is_win) {
</span><span class="lines">@@ -665,7 +675,10 @@
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   configs += [ ":debug_annotations_config" ]
</span><del>-  public_configs += [ ":libANGLE_config" ]
</del><ins>+  public_configs += [
+    ":libANGLE_config",
+    ":angle_backend_config",
+  ]
</ins><span class="cx"> 
</span><span class="cx">   # Windows ARM64 is available since 10.0.16299 so no need to copy
</span><span class="cx">   # d3dcompiler_47.dll because this file is available as inbox.
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ChangeLog  2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog     2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2019-07-17  Kenneth Russell  <kbr@chromium.org>
+
+        Make ANGLE work inside WebKit2's sandbox
+        https://bugs.webkit.org/show_bug.cgi?id=199844
+
+        Reviewed by Alex Christensen.
+
+        Cherry-pick fix for crbug.com/angleproject/3383 to eliminate use
+        of deprecated API in SystemInfo_mac.mm.
+
+        * BUILD.gn:
+        * src/gpu_info_util/SystemInfo.cpp:
+        (angle::FindActiveGPU):
+        (angle::PrintSystemInfo):
+        (angle::FindPrimaryGPU): Deleted.
+        * src/gpu_info_util/SystemInfo.h:
+        * src/gpu_info_util/SystemInfo_internal.h:
+        * src/gpu_info_util/SystemInfo_linux.cpp:
+        (angle::GetSystemInfo):
+        * src/gpu_info_util/SystemInfo_mac.mm:
+        (angle::GetSystemInfo):
+        * src/gpu_info_util/SystemInfo_win.cpp:
+        (angle::GetSystemInfo):
+        * src/tests/BUILD.gn:
+        * src/tests/test_expectations/GPUTestConfig.cpp:
+        * src/tests/test_utils/angle_test_instantiate.cpp:
+        (angle::IsConfigWhitelisted):
+
</ins><span class="cx"> 2019-07-10  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Allow CMake to build WebCore on Mac
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.cpp (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.cpp   2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.cpp      2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -238,12 +238,12 @@
</span><span class="cx">     return success;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FindPrimaryGPU(SystemInfo *info)
</del><ins>+void FindActiveGPU(SystemInfo *info)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!info->gpus.empty());
</span><span class="cx"> 
</span><del>-    // On dual-GPU systems we assume the non-Intel GPU is the primary one.
-    int primary   = 0;
</del><ins>+    // On dual-GPU systems we assume the non-Intel GPU is the graphics one.
+    int active    = 0;
</ins><span class="cx">     bool hasIntel = false;
</span><span class="cx">     for (size_t i = 0; i < info->gpus.size(); ++i)
</span><span class="cx">     {
</span><span class="lines">@@ -251,16 +251,17 @@
</span><span class="cx">         {
</span><span class="cx">             hasIntel = true;
</span><span class="cx">         }
</span><del>-        if (IsIntel(info->gpus[primary].vendorId))
</del><ins>+        if (IsIntel(info->gpus[active].vendorId))
</ins><span class="cx">         {
</span><del>-            primary = static_cast<int>(i);
</del><ins>+            active = static_cast<int>(i);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Assume that a combination of NVIDIA or AMD with Intel means Optimus or AMD Switchable
</span><del>-    info->primaryGPUIndex = primary;
-    info->isOptimus       = hasIntel && IsNVIDIA(info->gpus[primary].vendorId);
-    info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[primary].vendorId);
</del><ins>+    info->activeGPUIndex  = active;
+    info->primaryGPUIndex = active;
+    info->isOptimus       = hasIntel && IsNVIDIA(info->gpus[active].vendorId);
+    info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[active].vendorId);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PrintSystemInfo(const SystemInfo &info)
</span><span class="lines">@@ -289,7 +290,6 @@
</span><span class="cx"> 
</span><span class="cx">     std::cout << "\n";
</span><span class="cx">     std::cout << "Active GPU: " << info.activeGPUIndex << "\n";
</span><del>-    std::cout << "Primary GPU: " << info.primaryGPUIndex << "\n";
</del><span class="cx"> 
</span><span class="cx">     std::cout << "\n";
</span><span class="cx">     std::cout << "Optimus: " << (info.isOptimus ? "true" : "false") << "\n";
</span><span class="lines">@@ -308,10 +308,6 @@
</span><span class="cx">     {
</span><span class="cx">         std::cout << "Machine Model Version: " << info.machineModelVersion << "\n";
</span><span class="cx">     }
</span><del>-    if (!info.primaryDisplayDeviceId.empty())
-    {
-        std::cout << "Primary Display Device: " << info.primaryDisplayDeviceId << "\n";
-    }
</del><span class="cx">     std::cout << std::endl;
</span><span class="cx"> }
</span><span class="cx"> }  // namespace angle
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h     2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo.h        2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -58,13 +58,13 @@
</span><span class="cx"> 
</span><span class="cx">     std::vector<GPUDeviceInfo> gpus;
</span><span class="cx"> 
</span><del>-    // Index of the primary GPU (the discrete one on dual GPU systems) in `gpus`.
-    // Will never be -1 after a successful GetSystemInfo.
-    int primaryGPUIndex = -1;
-    // Index of the currently active GPU in `gpus`, can be -1 if the active GPU could not be
-    // detected.
</del><ins>+    // Index of the GPU expected to be used for 3D graphics. Based on a best-guess heuristic on
+    // some platforms. On windows, this is accurate.
</ins><span class="cx">     int activeGPUIndex = -1;
</span><span class="cx"> 
</span><ins>+    // Deprecated, same as activeGPUIndex
+    int primaryGPUIndex = -1;
+
</ins><span class="cx">     bool isOptimus       = false;
</span><span class="cx">     bool isAMDSwitchable = false;
</span><span class="cx">     // Only true on dual-GPU Mac laptops.
</span><span class="lines">@@ -78,9 +78,6 @@
</span><span class="cx"> 
</span><span class="cx">     // Only available on macOS
</span><span class="cx">     std::string machineModelVersion;
</span><del>-
-    // Only available on Windows, set even on failure.
-    std::string primaryDisplayDeviceId;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // Gathers information about the system without starting a GPU driver and returns them in `info`.
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_internalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_internal.h (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_internal.h    2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_internal.h       2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx">                           int32_t *minor);
</span><span class="cx"> bool CMDeviceIDToDeviceAndVendorID(const std::string &id, uint32_t *vendorId, uint32_t *deviceId);
</span><span class="cx"> 
</span><del>-// In the case there are multiple GPUs, this finds the primary one and sets Optimus or AMD
-// Switchable
-void FindPrimaryGPU(SystemInfo *info);
</del><ins>+// Use a heuristic to attempt to find the GPU used for 3D graphics. Sets activeGPUIndex,
+// isOptimus, and isAMDSwitchable. Deprecated: also sets primaryGPUIndex.
+void FindActiveGPU(SystemInfo *info);
</ins><span class="cx"> 
</span><span class="cx"> }  // namespace angle
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_linuxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_linux.cpp (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_linux.cpp     2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_linux.cpp        2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FindPrimaryGPU(info);
</del><ins>+    FindActiveGPU(info);
</ins><span class="cx"> 
</span><span class="cx">     for (size_t i = 0; i < info->gpus.size(); ++i)
</span><span class="cx">     {
</span><span class="lines">@@ -118,9 +118,9 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // In dual-GPU cases the PCI scan sometimes only gives us the Intel GPU.
-        // If we are able to query for the Nvidia driver version, it means there
-        // was hidden Nvidia GPU, so we add it to the list and make it primary.
</del><ins>+        // In dual-GPU cases the PCI scan sometimes only gives us the Intel GPU. If we are able to
+        // query for the Nvidia driver version, it means there was hidden Nvidia GPU, so we add it
+        // to the list.
</ins><span class="cx">         if (IsIntel(gpu->vendorId) && info->gpus.size() == 1)
</span><span class="cx">         {
</span><span class="cx">             std::string version;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_macmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm        2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_mac.mm   2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -72,22 +72,6 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// CGDisplayIOServicePort is deprecated as of macOS 10.9, but has no replacement, see
-// https://crbug.com/650837
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-
-// Find the info of the current GPU.
-bool GetActiveGPU(VendorID *vendorId, DeviceID *deviceId)
-{
-    io_registry_entry_t port = CGDisplayIOServicePort(kCGDirectMainDisplay);
-
-    return GetEntryProperty(port, CFSTR("vendor-id"), vendorId) &&
-           GetEntryProperty(port, CFSTR("device-id"), deviceId);
-}
-
-#pragma clang diagnostic pop
-
</del><span class="cx"> // Gathers the vendor and device IDs for the PCI GPUs
</span><span class="cx"> bool GetPCIDevices(std::vector<GPUDeviceInfo> *devices)
</span><span class="cx"> {
</span><span class="lines">@@ -145,27 +129,8 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Find the active GPU
-    {
-        VendorID activeVendor;
-        DeviceID activeDevice;
-        if (!GetActiveGPU(&activeVendor, &activeDevice))
-        {
-            return false;
-        }
</del><ins>+    FindActiveGPU(info);
</ins><span class="cx"> 
</span><del>-        for (size_t i = 0; i < info->gpus.size(); ++i)
-        {
-            if (info->gpus[i].vendorId == activeVendor && info->gpus[i].deviceId == activeDevice)
-            {
-                info->activeGPUIndex = static_cast<int>(i);
-                break;
-            }
-        }
-    }
-
-    FindPrimaryGPU(info);
-
</del><span class="cx">     // Figure out whether this is a dual-GPU system.
</span><span class="cx">     //
</span><span class="cx">     // TODO(kbr): this code was ported over from Chromium, and its correctness
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcgpu_info_utilSystemInfo_wincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_win.cpp (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_win.cpp       2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/gpu_info_util/SystemInfo_win.cpp  2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -14,18 +14,8 @@
</span><span class="cx"> // Windows.h needs to be included first
</span><span class="cx"> #include <windows.h>
</span><span class="cx"> 
</span><del>-#if defined(GPU_INFO_USE_SETUPAPI)
-// Remove parts of commctrl.h that have compile errors
-#    define NOTOOLBAR
-#    define NOTOOLTIPS
-#    include <cfgmgr32.h>
-#    include <setupapi.h>
-#elif defined(GPU_INFO_USE_DXGI)
-#    include <d3d10.h>
-#    include <dxgi.h>
-#else
-#    error "SystemInfo_win needs at least GPU_INFO_USE_SETUPAPI or GPU_INFO_USE_DXGI defined"
-#endif
</del><ins>+#include <d3d10.h>
+#include <dxgi.h>
</ins><span class="cx"> 
</span><span class="cx"> #include <array>
</span><span class="cx"> #include <sstream>
</span><span class="lines">@@ -36,110 +26,6 @@
</span><span class="cx"> namespace
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-// Returns the CM device ID of the primary GPU.
-std::string GetPrimaryDisplayDeviceId()
-{
-    DISPLAY_DEVICEA displayDevice;
-    displayDevice.cb = sizeof(DISPLAY_DEVICEA);
-
-    for (int i = 0; EnumDisplayDevicesA(nullptr, i, &displayDevice, 0); ++i)
-    {
-        if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
-        {
-            return displayDevice.DeviceID;
-        }
-    }
-
-    return "";
-}
-
-#if defined(GPU_INFO_USE_SETUPAPI)
-
-std::string GetRegistryStringValue(HKEY key, const char *valueName)
-{
-    std::array<char, 255> value;
-    DWORD valueSize = sizeof(value);
-    if (RegQueryValueExA(key, valueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(value.data()),
-                         &valueSize) == ERROR_SUCCESS)
-    {
-        return value.data();
-    }
-    return "";
-}
-
-// Gathers information about the devices from the registry. The reason why we aren't using
-// a dedicated API such as DXGI is that we need information like the driver vendor and date.
-// DXGI doesn't provide a way to know the device registry key from an IDXGIAdapter.
-bool GetDevicesFromRegistry(std::vector<GPUDeviceInfo> *devices)
-{
-    // Display adapter class GUID from
-    // https://msdn.microsoft.com/en-us/library/windows/hardware/ff553426%28v=vs.85%29.aspx
-    GUID displayClass = {
-        0x4d36e968, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}};
-
-    HDEVINFO deviceInfo = SetupDiGetClassDevsW(&displayClass, nullptr, nullptr, DIGCF_PRESENT);
-
-    if (deviceInfo == INVALID_HANDLE_VALUE)
-    {
-        return false;
-    }
-
-    // This iterates over the devices of the "Display adapter" class
-    DWORD deviceIndex = 0;
-    SP_DEVINFO_DATA deviceData;
-    deviceData.cbSize = sizeof(deviceData);
-    while (SetupDiEnumDeviceInfo(deviceInfo, deviceIndex++, &deviceData))
-    {
-        // The device and vendor IDs can be gathered directly, but information about the driver
-        // requires some registry digging
-        char fullDeviceID[MAX_DEVICE_ID_LEN];
-        if (CM_Get_Device_IDA(deviceData.DevInst, fullDeviceID, MAX_DEVICE_ID_LEN, 0) != CR_SUCCESS)
-        {
-            continue;
-        }
-
-        GPUDeviceInfo device;
-
-        if (!CMDeviceIDToDeviceAndVendorID(fullDeviceID, &device.vendorId, &device.deviceId))
-        {
-            continue;
-        }
-
-        // The driver key will end with something like {<displayClass>}/<4 digit number>.
-        std::array<WCHAR, 255> value;
-        if (!SetupDiGetDeviceRegistryPropertyW(deviceInfo, &deviceData, SPDRP_DRIVER, nullptr,
-                                               reinterpret_cast<PBYTE>(value.data()), sizeof(value),
-                                               nullptr))
-        {
-            continue;
-        }
-
-        std::wstring driverKey = L"System\\CurrentControlSet\\Control\\Class\\";
-        driverKey += value.data();
-
-        HKEY key;
-        if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.c_str(), 0, KEY_QUERY_VALUE, &key) !=
-            ERROR_SUCCESS)
-        {
-            continue;
-        }
-
-        device.driverVersion = GetRegistryStringValue(key, "DriverVersion");
-        device.driverDate    = GetRegistryStringValue(key, "DriverDate");
-        device.driverVendor  = GetRegistryStringValue(key, "ProviderName");
-
-        RegCloseKey(key);
-
-        devices->push_back(device);
-    }
-
-    SetupDiDestroyDeviceInfoList(deviceInfo);
-
-    return true;
-}
-
-#elif defined(GPU_INFO_USE_DXGI)
-
</del><span class="cx"> bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices)
</span><span class="cx"> {
</span><span class="cx">     IDXGIFactory *factory;
</span><span class="lines">@@ -185,33 +71,17 @@
</span><span class="cx"> 
</span><span class="cx">     factory->Release();
</span><span class="cx"> 
</span><del>-    return true;
</del><ins>+    return (i > 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#else
-#    error
-#endif
-
</del><span class="cx"> }  // anonymous namespace
</span><span class="cx"> 
</span><span class="cx"> bool GetSystemInfo(SystemInfo *info)
</span><span class="cx"> {
</span><del>-    // Get the CM device ID first so that it is returned even in error cases.
-    info->primaryDisplayDeviceId = GetPrimaryDisplayDeviceId();
-
-#if defined(GPU_INFO_USE_SETUPAPI)
-    if (!GetDevicesFromRegistry(&info->gpus))
-    {
-        return false;
-    }
-#elif defined(GPU_INFO_USE_DXGI)
</del><span class="cx">     if (!GetDevicesFromDXGI(&info->gpus))
</span><span class="cx">     {
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-#else
-#    error
-#endif
</del><span class="cx"> 
</span><span class="cx">     if (info->gpus.size() == 0)
</span><span class="cx">     {
</span><span class="lines">@@ -218,30 +88,16 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FindPrimaryGPU(info);
</del><ins>+    // Call FindActiveGPU to populate activeGPUIndex, isOptimus, and isAMDSwitchable.
+    FindActiveGPU(info);
</ins><span class="cx"> 
</span><del>-    // Override the primary GPU index with what we gathered from EnumDisplayDevices
-    uint32_t primaryVendorId = 0;
-    uint32_t primaryDeviceId = 0;
</del><ins>+    // Override activeGPUIndex. The first index returned by EnumAdapters is the active GPU. We
+    // can override the heuristic to find the active GPU
+    info->activeGPUIndex = 0;
+    // Deprecated: set primaryGPUIndex to the same index.
+    info->primaryGPUIndex = 0;
</ins><span class="cx"> 
</span><del>-    if (!CMDeviceIDToDeviceAndVendorID(info->primaryDisplayDeviceId, &primaryVendorId,
-                                       &primaryDeviceId))
-    {
-        return false;
-    }
-
-    bool foundPrimary = false;
-    for (size_t i = 0; i < info->gpus.size(); ++i)
-    {
-        if (info->gpus[i].vendorId == primaryVendorId && info->gpus[i].deviceId == primaryDeviceId)
-        {
-            info->primaryGPUIndex = static_cast<int>(i);
-            foundPrimary          = true;
-        }
-    }
-    ASSERT(foundPrimary);
-
-    // nvd3d9wrap.dll is loaded into all processes when Optimus is enabled.
</del><ins>+    // Override isOptimus. nvd3d9wrap.dll is loaded into all processes when Optimus is enabled.
</ins><span class="cx">     HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll");
</span><span class="cx">     info->isOptimus    = nvd3d9wrap != nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrctestsBUILDgn"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/tests/BUILD.gn (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/tests/BUILD.gn 2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/tests/BUILD.gn    2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -541,6 +541,7 @@
</span><span class="cx">     configs += [
</span><span class="cx">       "${angle_root}:libANGLE_config",
</span><span class="cx">       "${angle_root}:library_name_config",
</span><ins>+      "${angle_root}:angle_backend_config",
</ins><span class="cx">     ]
</span><span class="cx"> 
</span><span class="cx">     if (is_android) {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcteststest_expectationsGPUTestConfigcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/tests/test_expectations/GPUTestConfig.cpp (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/tests/test_expectations/GPUTestConfig.cpp      2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/tests/test_expectations/GPUTestConfig.cpp 2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -331,9 +331,9 @@
</span><span class="cx">     return sPopulated;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Get the primary GPUDeviceInfo from the SystemInfo struct.
-// Returns false if devInfo is not guaranteed to be set to the primary device.
-inline bool GetPrimaryGPU(GPUDeviceInfo **devInfo)
</del><ins>+// Get the active GPUDeviceInfo from the SystemInfo struct.
+// Returns false if devInfo is not guaranteed to be set to the active device.
+inline bool GetActiveGPU(GPUDeviceInfo **devInfo)
</ins><span class="cx"> {
</span><span class="cx">     SystemInfo *systemInfo = nullptr;
</span><span class="cx">     GetGPUTestSystemInfo(&systemInfo);
</span><span class="lines">@@ -343,10 +343,10 @@
</span><span class="cx">     }
</span><span class="cx">     // Default to the first index
</span><span class="cx">     uint32_t index = 0;
</span><del>-    // See if the primaryGPUIndex was set first
-    if (systemInfo->primaryGPUIndex != -1)
</del><ins>+    // See if the activeGPUIndex was set first
+    if (systemInfo->activeGPUIndex != -1)
</ins><span class="cx">     {
</span><del>-        index = systemInfo->primaryGPUIndex;
</del><ins>+        index = systemInfo->activeGPUIndex;
</ins><span class="cx">     }
</span><span class="cx">     ASSERT(index < systemInfo->gpus.size());
</span><span class="cx">     *devInfo = &(systemInfo->gpus[index]);
</span><span class="lines">@@ -353,14 +353,14 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Get the vendor ID of the primary GPU from the SystemInfo struct.
</del><ins>+// Get the vendor ID of the active GPU from the SystemInfo struct.
</ins><span class="cx"> // Returns 0 if there is an error.
</span><del>-inline VendorID GetPrimaryGPUVendorID()
</del><ins>+inline VendorID GetActiveGPUVendorID()
</ins><span class="cx"> {
</span><del>-    GPUDeviceInfo *primaryGPU = nullptr;
-    if (GetPrimaryGPU(&primaryGPU))
</del><ins>+    GPUDeviceInfo *activeGPU = nullptr;
+    if (GetActiveGPU(&activeGPU))
</ins><span class="cx">     {
</span><del>-        return primaryGPU->vendorId;
</del><ins>+        return activeGPU->vendorId;
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -368,14 +368,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Get the device ID of the primary GPU from the SystemInfo struct.
</del><ins>+// Get the device ID of the active GPU from the SystemInfo struct.
</ins><span class="cx"> // Returns 0 if there is an error.
</span><del>-inline DeviceID GetPrimaryGPUDeviceID()
</del><ins>+inline DeviceID GetActiveGPUDeviceID()
</ins><span class="cx"> {
</span><del>-    GPUDeviceInfo *primaryGPU = nullptr;
-    if (GetPrimaryGPU(&primaryGPU))
</del><ins>+    GPUDeviceInfo *activeGPU = nullptr;
+    if (GetActiveGPU(&activeGPU))
</ins><span class="cx">     {
</span><del>-        return primaryGPU->deviceId;
</del><ins>+        return activeGPU->deviceId;
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -383,28 +383,28 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Check whether the primary GPU is NVIDIA.
</del><ins>+// Check whether the active GPU is NVIDIA.
</ins><span class="cx"> inline bool IsNVIDIA()
</span><span class="cx"> {
</span><del>-    return angle::IsNVIDIA(GetPrimaryGPUVendorID());
</del><ins>+    return angle::IsNVIDIA(GetActiveGPUVendorID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Check whether the primary GPU is AMD.
</del><ins>+// Check whether the active GPU is AMD.
</ins><span class="cx"> inline bool IsAMD()
</span><span class="cx"> {
</span><del>-    return angle::IsAMD(GetPrimaryGPUVendorID());
</del><ins>+    return angle::IsAMD(GetActiveGPUVendorID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Check whether the primary GPU is Intel.
</del><ins>+// Check whether the active GPU is Intel.
</ins><span class="cx"> inline bool IsIntel()
</span><span class="cx"> {
</span><del>-    return angle::IsIntel(GetPrimaryGPUVendorID());
</del><ins>+    return angle::IsIntel(GetActiveGPUVendorID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Check whether the primary GPU is VMWare.
</del><ins>+// Check whether the active GPU is VMWare.
</ins><span class="cx"> inline bool IsVMWare()
</span><span class="cx"> {
</span><del>-    return angle::IsVMWare(GetPrimaryGPUVendorID());
</del><ins>+    return angle::IsVMWare(GetActiveGPUVendorID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Check whether this is a debug build.
</span><span class="lines">@@ -460,7 +460,7 @@
</span><span class="cx">         // PushErrorMessage(kErrorMessage[kErrorEntryWithGpuDeviceIdConflicts], line_number);
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-    return (deviceId == GetPrimaryGPUDeviceID());
</del><ins>+    return (deviceId == GetActiveGPUDeviceID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Check whether the active GPU is a NVIDIA Quadro P400
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcteststest_utilsangle_test_instantiatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/tests/test_utils/angle_test_instantiate.cpp (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/tests/test_utils/angle_test_instantiate.cpp    2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/ThirdParty/ANGLE/src/tests/test_utils/angle_test_instantiate.cpp       2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -185,7 +185,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters &param)
</span><span class="cx"> {
</span><del>-    VendorID vendorID = systemInfo.gpus[systemInfo.primaryGPUIndex].vendorId;
</del><ins>+    VendorID vendorID = systemInfo.gpus[systemInfo.activeGPUIndex].vendorId;
</ins><span class="cx"> 
</span><span class="cx">     // We support the default and null back-ends on every platform.
</span><span class="cx">     if (param.driver == GLESDriverType::AngleEGL)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/WebCore/ChangeLog      2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2019-07-17  Kenneth Russell  <kbr@chromium.org>
+
+        Make ANGLE work inside WebKit2's sandbox
+        https://bugs.webkit.org/show_bug.cgi?id=199844
+
+        Reviewed by Alex Christensen.
+
+        Fix missing #import introduced at the last minute while removing
+        some debugging code in the last patch.
+
+        Tested with San Angeles WebGL demo and some conformance tests.
+
+        * platform/graphics/cocoa/WebGLLayer.mm:
+
</ins><span class="cx"> 2019-07-17  Andres Gonzalez  <andresg_22@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Hang in WebCore::AccessibilityRenderObject::visiblePositionRangeForLine.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaWebGLLayermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm (247520 => 247521)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm       2019-07-17 17:09:04 UTC (rev 247520)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm  2019-07-17 17:50:45 UTC (rev 247521)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #import "GraphicsLayer.h"
</span><span class="cx"> #import "GraphicsLayerCA.h"
</span><span class="cx"> #import "ImageBufferUtilitiesCG.h"
</span><ins>+#import "NotImplemented.h"
</ins><span class="cx"> #import "PlatformCALayer.h"
</span><span class="cx"> #import <pal/spi/cocoa/QuartzCoreSPI.h>
</span><span class="cx"> #import <wtf/FastMalloc.h>
</span></span></pre>
</div>
</div>

</body>
</html>