From 60650abf09236d4a8ea24991a3b892776cdb86bf Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Wed, 11 Aug 2021 12:43:33 -0700 Subject: [PATCH] fix: explicitly define REFGUID from ::GUID&, not base::GUID (#30442) * fix: explicitly define REFGUID from ::GUID& Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3076480 * fix: duplicate GUID_NULL symbol, add comment --- shell/common/crash_keys.cc | 6 +----- shell/common/gin_converters/guid_converter.h | 13 ++++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/shell/common/crash_keys.cc b/shell/common/crash_keys.cc index 43bd981d52c6..3595050be6c5 100644 --- a/shell/common/crash_keys.cc +++ b/shell/common/crash_keys.cc @@ -41,15 +41,13 @@ #include "shell/browser/api/electron_api_service_worker_context.h" #include "shell/browser/api/electron_api_session.h" #include "shell/browser/api/electron_api_system_preferences.h" +#include "shell/browser/api/electron_api_tray.h" #include "shell/browser/api/electron_api_url_loader.h" #include "shell/browser/api/electron_api_web_contents.h" #include "shell/browser/api/electron_api_web_frame_main.h" #include "shell/browser/api/electron_api_web_request.h" #include "shell/browser/api/event.h" #include "shell/common/api/electron_api_native_image.h" -#if !defined(OS_WIN) -#include "shell/browser/api/electron_api_tray.h" -#endif namespace electron { @@ -207,10 +205,8 @@ void SetCrashKeyForGinWrappable(gin::WrapperInfo* info) { else if (info == &electron::api::DesktopCapturer::kWrapperInfo) crash_location = "DesktopCapturer"; #endif -#if !defined(OS_WIN) else if (info == &electron::api::Tray::kWrapperInfo) crash_location = "Tray"; -#endif // OS_WIN else if (info == &electron::api::NetLog::kWrapperInfo) crash_location = "NetLog"; else if (info == &electron::api::NativeImage::kWrapperInfo) diff --git a/shell/common/gin_converters/guid_converter.h b/shell/common/gin_converters/guid_converter.h index ee816ceb5576..ef7dd7a0d2f4 100644 --- a/shell/common/gin_converters/guid_converter.h +++ b/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 #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 { } static v8::Local ToV8(v8::Isolate* isolate, UUID val) { #if defined(OS_WIN) + const GUID GUID_NULL = {}; if (val == GUID_NULL) { return StringToV8(isolate, ""); } else {