Title: [288507] branches/safari-613-branch/Source/ThirdParty/ANGLE
Revision
288507
Author
[email protected]
Date
2022-01-24 17:55:23 -0800 (Mon, 24 Jan 2022)

Log Message

Cherry-pick r288074. rdar://problem/87653812

    REGRESSION (r286603): Leak of three NSMutableDictionary objects each time rx::DisplayMtl::getMetalDeviceMatchingAttribute() is called
    <https://webkit.org/b/235278>
    <rdar://problem/87653812>

    Reviewed by Darin Adler.

    * src/libANGLE/renderer/metal/DisplayMtl.mm:
    (rx::DisplayMtl::getMetalDeviceMatchingAttribute):
    - Make use of mtl::adoptObjCObj<> so these objects are relaseed
      when the method returns.

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/ThirdParty/ANGLE/ChangeLog (288506 => 288507)


--- branches/safari-613-branch/Source/ThirdParty/ANGLE/ChangeLog	2022-01-25 01:55:20 UTC (rev 288506)
+++ branches/safari-613-branch/Source/ThirdParty/ANGLE/ChangeLog	2022-01-25 01:55:23 UTC (rev 288507)
@@ -1,3 +1,34 @@
+2022-01-24  Alan Coon  <[email protected]>
+
+        Cherry-pick r288074. rdar://problem/87653812
+
+    REGRESSION (r286603): Leak of three NSMutableDictionary objects each time rx::DisplayMtl::getMetalDeviceMatchingAttribute() is called
+    <https://webkit.org/b/235278>
+    <rdar://problem/87653812>
+    
+    Reviewed by Darin Adler.
+    
+    * src/libANGLE/renderer/metal/DisplayMtl.mm:
+    (rx::DisplayMtl::getMetalDeviceMatchingAttribute):
+    - Make use of mtl::adoptObjCObj<> so these objects are relaseed
+      when the method returns.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-16  David Kilzer  <[email protected]>
+
+            REGRESSION (r286603): Leak of three NSMutableDictionary objects each time rx::DisplayMtl::getMetalDeviceMatchingAttribute() is called
+            <https://webkit.org/b/235278>
+            <rdar://problem/87653812>
+
+            Reviewed by Darin Adler.
+
+            * src/libANGLE/renderer/metal/DisplayMtl.mm:
+            (rx::DisplayMtl::getMetalDeviceMatchingAttribute):
+            - Make use of mtl::adoptObjCObj<> so these objects are relaseed
+              when the method returns.
+
 2022-01-14  Russell Epstein  <[email protected]>
 
         Cherry-pick r288041. rdar://problem/87627318

Modified: branches/safari-613-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm (288506 => 288507)


--- branches/safari-613-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm	2022-01-25 01:55:20 UTC (rev 288506)
+++ branches/safari-613-branch/Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm	2022-01-25 01:55:23 UTC (rev 288507)
@@ -238,22 +238,22 @@
 #if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
     auto deviceList = mtl::adoptObjCObj(MTLCopyAllDevices());
 
-    NSMutableArray<id<MTLDevice>> *externalGPUs   = [[NSMutableArray alloc] init];
-    NSMutableArray<id<MTLDevice>> *integratedGPUs = [[NSMutableArray alloc] init];
-    NSMutableArray<id<MTLDevice>> *discreteGPUs   = [[NSMutableArray alloc] init];
+    auto externalGPUs = mtl::adoptObjCObj<NSMutableArray<id<MTLDevice>>>([[NSMutableArray alloc] init]);
+    auto integratedGPUs = mtl::adoptObjCObj<NSMutableArray<id<MTLDevice>>>([[NSMutableArray alloc] init]);
+    auto discreteGPUs = mtl::adoptObjCObj<NSMutableArray<id<MTLDevice>>>([[NSMutableArray alloc] init]);
     for (id<MTLDevice> device in deviceList.get())
     {
         if (device.removable)
         {
-            [externalGPUs addObject:device];
+            [externalGPUs.get() addObject:device];
         }
         else if (device.lowPower)
         {
-            [integratedGPUs addObject:device];
+            [integratedGPUs.get() addObject:device];
         }
         else
         {
-            [discreteGPUs addObject:device];
+            [discreteGPUs.get() addObject:device];
         }
     }
     // TODO(kpiddington: External GPU support. Do we prefer high power / low bandwidth for general
@@ -262,7 +262,7 @@
     if (attribs.get(EGL_POWER_PREFERENCE_ANGLE, 0) == EGL_HIGH_POWER_ANGLE)
     {
         // Search for a discrete GPU first.
-        for (id<MTLDevice> device in discreteGPUs)
+        for (id<MTLDevice> device in discreteGPUs.get())
         {
             if (![device isHeadless])
                 return device;
@@ -271,7 +271,7 @@
     else if (attribs.get(EGL_POWER_PREFERENCE_ANGLE, 0) == EGL_LOW_POWER_ANGLE)
     {
         // If we've selected a low power device, look through integrated devices.
-        for (id<MTLDevice> device in integratedGPUs)
+        for (id<MTLDevice> device in integratedGPUs.get())
         {
             if (![device isHeadless])
                 return device;
@@ -295,7 +295,7 @@
     }
 
     // Default to use a low power device, look through integrated devices.
-    for (id<MTLDevice> device in integratedGPUs)
+    for (id<MTLDevice> device in integratedGPUs.get())
     {
         if (![device isHeadless])
             return device;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to