Fix a warning for the use of kIOMasterPortDefault.

Because this is a breaking deprecation in macOS 12.0 we temporarily add
our own constant equal to 0 (the documented value of this constant).

Bug: chromium:1400252
Change-Id: I5eb66aa043769c23975792223accd996cb919462
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152540
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/native/metal/BackendMTL.mm b/src/dawn/native/metal/BackendMTL.mm
index 9d541e5..fb10665 100644
--- a/src/dawn/native/metal/BackendMTL.mm
+++ b/src/dawn/native/metal/BackendMTL.mm
@@ -118,10 +118,18 @@
         return DAWN_INTERNAL_ERROR("Failed to create the matching dict for the device");
     }
 
+    // Work around a breaking deprecation of kIOMasterPortDefault to kIOMainPortDefault. Both values
+    // are equivalent with NULL (given mach_port_t is an unsigned int they probably mean 0) as noted
+    // by the IOKitLib.h comments so use that directly.
+    // TODO(chromium:1400252): Use kIOMainPortDefault once the minimum supported version includes
+    // macOS 12.0
+    constexpr mach_port_t kIOMainPort = 0;
+
     // IOServiceGetMatchingService will consume the reference on the matching dictionary,
     // so we don't need to release the dictionary.
     IORef<io_registry_entry_t> acceleratorEntry =
-        AcquireIORef(IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict.Detach()));
+        AcquireIORef(IOServiceGetMatchingService(kIOMainPort, matchingDict.Detach()));
+
     if (acceleratorEntry == IO_OBJECT_NULL) {
         return DAWN_INTERNAL_ERROR("Failed to get the IO registry entry for the accelerator");
     }