Skip to content

Commit fab9648

Browse files
miniaknornagon
authored andcommitted
fix: rename WebSwapCGLLayer to WebSwapCGLLayerChromium (electron#35961)
* fix: rename WebSwapCGLLayer to WebSwapCGLLayerChromium * undo changes to patches/config.json Co-authored-by: Jeremy Rose <[email protected]>
1 parent 94ce70d commit fab9648

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

patches/angle/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix_rename_webswapcgllayer_to_webswapcgllayerchromium.patch
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Milan Burda <[email protected]>
3+
Date: Mon, 10 Oct 2022 15:11:08 +0400
4+
Subject: fix: rename WebSwapCGLLayer to WebSwapCGLLayerChromium
5+
6+
Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x23c589b50)
7+
and src/out/testing/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x1123f8488).
8+
One of the two will be used. Which one is undefined.
9+
10+
diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h
11+
index 7101cd271c07e604c6f5241d1a22f59f446c0033..98a89976f87e32a66bd504951698204fad938d57 100644
12+
--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h
13+
+++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h
14+
@@ -18,7 +18,7 @@ struct __IOSurface;
15+
typedef __IOSurface *IOSurfaceRef;
16+
17+
// WebKit's build process requires that every Objective-C class name has the prefix "Web".
18+
-@class WebSwapCGLLayer;
19+
+@class WebSwapCGLLayerChromium;
20+
21+
namespace rx
22+
{
23+
@@ -89,7 +89,7 @@ class WindowSurfaceCGL : public SurfaceGL
24+
gl::Framebuffer *framebuffer) override;
25+
26+
private:
27+
- WebSwapCGLLayer *mSwapLayer;
28+
+ WebSwapCGLLayerChromium *mSwapLayer;
29+
SharedSwapState mSwapState;
30+
uint64_t mCurrentSwapId;
31+
32+
diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
33+
index 27990e9c2facbbe0e30f4b275e0778a6474fb9ce..84f9fa9b6d31fb0e85a4c4270dff4d935f855c26 100644
34+
--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
35+
+++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
36+
@@ -24,7 +24,7 @@
37+
# include "libANGLE/renderer/gl/StateManagerGL.h"
38+
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
39+
40+
-@interface WebSwapCGLLayer : CAOpenGLLayer {
41+
+@interface WebSwapCGLLayerChromium : CAOpenGLLayer {
42+
CGLContextObj mDisplayContext;
43+
44+
bool initialized;
45+
@@ -38,7 +38,7 @@ - (id)initWithSharedState:(rx::SharedSwapState *)swapState
46+
withFunctions:(const rx::FunctionsGL *)functions;
47+
@end
48+
49+
-@implementation WebSwapCGLLayer
50+
+@implementation WebSwapCGLLayerChromium
51+
- (id)initWithSharedState:(rx::SharedSwapState *)swapState
52+
withContext:(CGLContextObj)displayContext
53+
withFunctions:(const rx::FunctionsGL *)functions
54+
@@ -220,9 +220,9 @@ - (void)drawInCGLContext:(CGLContextObj)glContext
55+
mSwapState.lastRendered = &mSwapState.textures[1];
56+
mSwapState.beingPresented = &mSwapState.textures[2];
57+
58+
- mSwapLayer = [[WebSwapCGLLayer alloc] initWithSharedState:&mSwapState
59+
- withContext:mContext
60+
- withFunctions:mFunctions];
61+
+ mSwapLayer = [[WebSwapCGLLayerChromium alloc] initWithSharedState:&mSwapState
62+
+ withContext:mContext
63+
+ withFunctions:mFunctions];
64+
[mLayer addSublayer:mSwapLayer];
65+
[mSwapLayer setContentsScale:[mLayer contentsScale]];
66+

patches/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"src/electron/patches/chromium": "src",
33

4+
"src/electron/patches/angle": "src/third_party/angle",
5+
46
"src/electron/patches/boringssl": "src/third_party/boringssl/src",
57

68
"src/electron/patches/devtools_frontend": "src/third_party/devtools-frontend/src",

0 commit comments

Comments
 (0)