Browse Source

fix: explicitly define REFGUID from ::GUID&, not base::GUID (#30442) (#30499)

* fix: explicitly define REFGUID from ::GUID&

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3076480

* fix: duplicate GUID_NULL symbol, add comment
Keeley Hammond 3 years ago
parent
commit
e4fcbe9dc8
1 changed files with 12 additions and 1 deletions
  1. 12 1
      shell/common/gin_converters/guid_converter.h

+ 12 - 1
shell/common/gin_converters/guid_converter.h

@@ -10,6 +10,17 @@
 #include "gin/converter.h"
 
 #if defined(OS_WIN)
+// c.f.:
+// https://chromium-review.googlesource.com/c/chromium/src/+/3076480
+// REFGUID is currently incorrectly inheriting its type
+// from base::GUID, when it should be inheriting from ::GUID.
+// This workaround prevents build errors until the CL is merged
+#ifdef _REFGUID_DEFINED
+#undef REFGUID
+#endif
+#define REFGUID const ::GUID&
+#define _REFGUID_DEFINED
+
 #include <rpc.h>
 
 #include "base/strings/sys_string_conversions.h"
@@ -18,7 +29,6 @@
 
 #if defined(OS_WIN)
 typedef GUID UUID;
-const GUID GUID_NULL = {};
 #else
 typedef struct {
 } UUID;
@@ -58,6 +68,7 @@ struct Converter<UUID> {
   }
   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, UUID val) {
 #if defined(OS_WIN)
+    const GUID GUID_NULL = {};
     if (val == GUID_NULL) {
       return StringToV8(isolate, "");
     } else {