Title: [270064] trunk/Source/WebCore
Revision
270064
Author
d...@apple.com
Date
2020-11-19 17:40:53 -0800 (Thu, 19 Nov 2020)

Log Message

Link against the ANGLE Shared Library
https://bugs.webkit.org/show_bug.cgi?id=218539
<rdar://problem/69062211>

Reviewed by Tim Horton.

Weak link against libANGLE-shared.dylib.

* Configurations/WebCore.xcconfig:
* Configurations/WebCoreTestSupport.xcconfig:
* Sources.txt: Stop compiling ANGLEWebKitBridge.
* SourcesGTK.txt:
* SourcesWPE.txt:
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::isANGLEAvailable): Add a helper to check if ANGLE loaded properly.
(WebCore::GraphicsContextGLOpenGL::create):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270063 => 270064)


--- trunk/Source/WebCore/ChangeLog	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/ChangeLog	2020-11-20 01:40:53 UTC (rev 270064)
@@ -1,3 +1,22 @@
+2020-11-19  Dean Jackson  <d...@apple.com>
+
+        Link against the ANGLE Shared Library
+        https://bugs.webkit.org/show_bug.cgi?id=218539
+        <rdar://problem/69062211>
+
+        Reviewed by Tim Horton.
+
+        Weak link against libANGLE-shared.dylib.
+
+        * Configurations/WebCore.xcconfig:
+        * Configurations/WebCoreTestSupport.xcconfig:
+        * Sources.txt: Stop compiling ANGLEWebKitBridge.
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::isANGLEAvailable): Add a helper to check if ANGLE loaded properly.
+        (WebCore::GraphicsContextGLOpenGL::create):
+
 2020-11-19  Geoffrey Garen  <gga...@apple.com>
 
         [Mac] LayoutTest fast/mediacapturefromelement/CanvasCaptureMediaStream-webgl-events.html is a flaky timeout

Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (270063 => 270064)


--- trunk/Source/WebCore/Configurations/WebCore.xcconfig	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig	2020-11-20 01:40:53 UTC (rev 270064)
@@ -40,12 +40,12 @@
 
 SYSTEM_FRAMEWORK_SEARCH_PATHS = $(inherited) $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks
 
-WK_LIBWEBRTC_LIBRARY_DIR = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Frameworks
-WK_LIBWEBRTC_LIBRARY_DIR[sdk=macosx*] = $(WK_LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
-WK_LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Versions/A/Frameworks;
-WK_LIBWEBRTC_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
+WK_FRAMEWORKS_LIBRARY_DIR = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Frameworks
+WK_FRAMEWORKS_LIBRARY_DIR[sdk=macosx*] = $(WK_FRAMEWORKS_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
+WK_FRAMEWORKS_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(WEBCORE_FRAMEWORKS_DIR)/WebCore.framework/Versions/A/Frameworks;
+WK_FRAMEWORKS_LIBRARY_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
 
-LIBRARY_SEARCH_PATHS = $(inherited) "$(WK_LIBWEBRTC_LIBRARY_DIR)";
+LIBRARY_SEARCH_PATHS = $(inherited) "$(WK_FRAMEWORKS_LIBRARY_DIR)";
 
 WEBKITADDITIONS_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include/WebKitAdditions $(SDKROOT)/usr/local/include/WebKitAdditions;
 ANGLE_HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)$(WK_ALTERNATE_FRAMEWORKS_DIR)/usr/local/include/ $(SDKROOT)$(WK_ALTERNATE_WEBKIT_SDK_PATH)/usr/local/include/;
@@ -69,6 +69,8 @@
 PRODUCT_BUNDLE_IDENTIFIER = com.apple.$(PRODUCT_NAME:rfc1034identifier);
 UNEXPORTED_SYMBOLS_FILE = Configurations/WebCore.unexp;
 
+WK_ANGLE_LDFLAGS = -weak-lANGLE-shared;
+
 WK_APPKIT_LDFLAGS = $(WK_APPKIT_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_APPKIT_LDFLAGS_macosx = -framework AppKit;
 WK_APPKIT_LDFLAGS_maccatalyst = -framework AppKit;
@@ -122,7 +124,7 @@
 WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
 
 // FIXME: Reduce the number of allowable_clients <rdar://problem/31823969>
-OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework IOSurface -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_ACCELERATOR_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_NETWORK_EXTENSION_LD_FLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_CORE_IMAGE_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
+OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) -lsqlite3 -lobjc -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework IOSurface -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_ANGLE_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_ACCELERATOR_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_NETWORK_EXTENSION_LD_FLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_CORE_IMAGE_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
 
 OTHER_LDFLAGS_PLATFORM_cocoatouch = -allowable_client WebKit -allowable_client iTunesU -allowable_client Casablanca -allowable_client Remote -allowable_client TVBooks -allowable_client DumpRenderTree -allowable_client WebKitTestRunner -allowable_client TestWebKitAPI;
 OTHER_LDFLAGS_PLATFORM_macosx = -sub_library libobjc -umbrella WebKit;

Modified: trunk/Source/WebCore/Configurations/WebCoreTestSupport.xcconfig (270063 => 270064)


--- trunk/Source/WebCore/Configurations/WebCoreTestSupport.xcconfig	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/Configurations/WebCoreTestSupport.xcconfig	2020-11-20 01:40:53 UTC (rev 270064)
@@ -52,14 +52,16 @@
 LIBWEBRTC_LDFLAGS_ = ;
 LIBWEBRTC_LDFLAGS_ENABLE_WEB_RTC = -weak-lwebrtc;
 
+ANGLE_LDFLAGS = -weak-lANGLE-shared;
+
 PRODUCT_NAME = WebCoreTestSupport;
 EXECUTABLE_PREFIX = lib;
 EXPORTED_SYMBOLS_FILE = ;
 GCC_SYMBOLS_PRIVATE_EXTERN = YES;
-OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
-OTHER_LDFLAGS[sdk=macos*] = $(ASAN_OTHER_LDFLAGS) -framework AppKit $(LIBWEBRTC_LDFLAGS);
+OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS) $(ANGLE_LDFLAGS);
+OTHER_LDFLAGS[sdk=macos*] = $(ASAN_OTHER_LDFLAGS) -framework AppKit $(ANGLE_LDFLAGS) $(LIBWEBRTC_LDFLAGS);
 
-OTHER_LDFLAGS[sdk=iphone*] = $(ASAN_OTHER_LDFLAGS) -lAccessibility -framework CoreText $(LIBWEBRTC_LDFLAGS);
+OTHER_LDFLAGS[sdk=iphone*] = $(ASAN_OTHER_LDFLAGS) -lAccessibility -framework CoreText $(ANGLE_LDFLAGS) $(LIBWEBRTC_LDFLAGS);
 SECT_ORDER_FLAGS = ;
 
 ENTITLEMENTS_REQUIRED = $(ENTITLEMENTS_REQUIRED_USE_INTERNAL_SDK_$(USE_INTERNAL_SDK))

Modified: trunk/Source/WebCore/Sources.txt (270063 => 270064)


--- trunk/Source/WebCore/Sources.txt	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/Sources.txt	2020-11-20 01:40:53 UTC (rev 270064)
@@ -1886,7 +1886,6 @@
 platform/gamepad/EmptyGamepadProvider.cpp
 platform/gamepad/GamepadConstants.cpp
 platform/gamepad/GamepadProvider.cpp
-platform/graphics/ANGLEWebKitBridge.cpp
 platform/graphics/BitmapImage.cpp
 platform/graphics/Color.cpp
 platform/graphics/ColorBlending.cpp

Modified: trunk/Source/WebCore/SourcesGTK.txt (270063 => 270064)


--- trunk/Source/WebCore/SourcesGTK.txt	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/SourcesGTK.txt	2020-11-20 01:40:53 UTC (rev 270064)
@@ -72,6 +72,7 @@
 
 platform/generic/ScrollAnimatorGeneric.cpp
 
+platform/graphics/ANGLEWebKitBridge.cpp
 platform/graphics/GLContext.cpp @no-unify
 platform/graphics/PlatformDisplay.cpp @no-unify
 

Modified: trunk/Source/WebCore/SourcesWPE.txt (270063 => 270064)


--- trunk/Source/WebCore/SourcesWPE.txt	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/SourcesWPE.txt	2020-11-20 01:40:53 UTC (rev 270064)
@@ -65,6 +65,7 @@
 
 platform/generic/ScrollAnimatorGeneric.cpp
 
+platform/graphics/ANGLEWebKitBridge.cpp
 platform/graphics/GLContext.cpp
 platform/graphics/PlatformDisplay.cpp
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (270063 => 270064)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-11-20 01:23:54 UTC (rev 270063)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-11-20 01:40:53 UTC (rev 270064)
@@ -39,6 +39,7 @@
 #import "WebGLLayer.h"
 #import <CoreGraphics/CGBitmapContext.h>
 #import <wtf/BlockObjCExceptions.h>
+#import <wtf/darwin/WeakLinking.h>
 #import <wtf/text/CString.h>
 
 #if PLATFORM(MAC)
@@ -50,6 +51,8 @@
 #include "GraphicsContextGLCV.h"
 #endif
 
+WTF_WEAK_LINK_FORCE_IMPORT(EGL_Initialize);
+
 namespace WebCore {
 
 #if ASSERT_ENABLED
@@ -122,9 +125,19 @@
 }
 #endif
 
+static bool isANGLEAvailable()
+{
+    return !!EGL_Initialize;
+}
 
 RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attrs, HostWindow* hostWindow, GraphicsContextGL::Destination destination)
 {
+    // If ANGLE is not loaded, we can fail immediately.
+    if (!isANGLEAvailable()) {
+        LOG(WebGL, "ANGLE shared library was not loaded. Can't make GraphicsContextGL.");
+        return nullptr;
+    }
+
     // This implementation doesn't currently support rendering directly to the HostWindow.
     if (destination == Destination::DirectlyToHostWindow)
         return nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to