From 270f2dbf18af395ffdbf5d60844879ace053b923 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Thu, 5 Jan 2023 07:49:08 +0100 Subject: [PATCH] fix: rename WebSwapCGLLayer to WebSwapCGLLayerChromium (#35961) * fix: rename WebSwapCGLLayer to WebSwapCGLLayerChromium * undo changes to patches/config.json Co-authored-by: Jeremy Rose --- patches/angle/.patches | 1 + ...pcgllayer_to_webswapcgllayerchromium.patch | 66 +++++++++++++++++++ patches/config.json | 2 + 3 files changed, 69 insertions(+) create mode 100644 patches/angle/.patches create mode 100644 patches/angle/fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch diff --git a/patches/angle/.patches b/patches/angle/.patches new file mode 100644 index 0000000000000..ca864b58a91d0 --- /dev/null +++ b/patches/angle/.patches @@ -0,0 +1 @@ +fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch diff --git a/patches/angle/fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch b/patches/angle/fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch new file mode 100644 index 0000000000000..a13e32902ade5 --- /dev/null +++ b/patches/angle/fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch @@ -0,0 +1,66 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Milan Burda +Date: Mon, 10 Oct 2022 15:11:08 +0400 +Subject: fix: rename WebSwapCGLLayer to WebSwapCGLLayerChromium + +Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x23c589b50) +and src/out/testing/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x1123f8488). +One of the two will be used. Which one is undefined. + +diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h +index 7101cd271c07e604c6f5241d1a22f59f446c0033..98a89976f87e32a66bd504951698204fad938d57 100644 +--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h ++++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h +@@ -18,7 +18,7 @@ struct __IOSurface; + typedef __IOSurface *IOSurfaceRef; + + // WebKit's build process requires that every Objective-C class name has the prefix "Web". +-@class WebSwapCGLLayer; ++@class WebSwapCGLLayerChromium; + + namespace rx + { +@@ -89,7 +89,7 @@ class WindowSurfaceCGL : public SurfaceGL + gl::Framebuffer *framebuffer) override; + + private: +- WebSwapCGLLayer *mSwapLayer; ++ WebSwapCGLLayerChromium *mSwapLayer; + SharedSwapState mSwapState; + uint64_t mCurrentSwapId; + +diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm +index 27990e9c2facbbe0e30f4b275e0778a6474fb9ce..84f9fa9b6d31fb0e85a4c4270dff4d935f855c26 100644 +--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm ++++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm +@@ -24,7 +24,7 @@ + # include "libANGLE/renderer/gl/StateManagerGL.h" + # include "libANGLE/renderer/gl/cgl/DisplayCGL.h" + +-@interface WebSwapCGLLayer : CAOpenGLLayer { ++@interface WebSwapCGLLayerChromium : CAOpenGLLayer { + CGLContextObj mDisplayContext; + + bool initialized; +@@ -38,7 +38,7 @@ - (id)initWithSharedState:(rx::SharedSwapState *)swapState + withFunctions:(const rx::FunctionsGL *)functions; + @end + +-@implementation WebSwapCGLLayer ++@implementation WebSwapCGLLayerChromium + - (id)initWithSharedState:(rx::SharedSwapState *)swapState + withContext:(CGLContextObj)displayContext + withFunctions:(const rx::FunctionsGL *)functions +@@ -220,9 +220,9 @@ - (void)drawInCGLContext:(CGLContextObj)glContext + mSwapState.lastRendered = &mSwapState.textures[1]; + mSwapState.beingPresented = &mSwapState.textures[2]; + +- mSwapLayer = [[WebSwapCGLLayer alloc] initWithSharedState:&mSwapState +- withContext:mContext +- withFunctions:mFunctions]; ++ mSwapLayer = [[WebSwapCGLLayerChromium alloc] initWithSharedState:&mSwapState ++ withContext:mContext ++ withFunctions:mFunctions]; + [mLayer addSublayer:mSwapLayer]; + [mSwapLayer setContentsScale:[mLayer contentsScale]]; + diff --git a/patches/config.json b/patches/config.json index db929cb196534..703821a3e6dcd 100644 --- a/patches/config.json +++ b/patches/config.json @@ -1,6 +1,8 @@ { "src/electron/patches/chromium": "src", + "src/electron/patches/angle": "src/third_party/angle", + "src/electron/patches/boringssl": "src/third_party/boringssl/src", "src/electron/patches/devtools_frontend": "src/third_party/devtools-frontend/src",