Title: [238955] trunk/Source/WTF
Revision
238955
Author
[email protected]
Date
2018-12-07 10:40:31 -0800 (Fri, 07 Dec 2018)

Log Message

[Cocoa] Add optional variants of SOFT_LINK_CLASS_FOR_SOURCE
https://bugs.webkit.org/show_bug.cgi?id=192498

Reviewed by Tim Horton.

Added SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL and SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT,
which behave like their non-optional variants but do not require their classes to exist.

* wtf/cocoa/SoftLinking.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (238954 => 238955)


--- trunk/Source/WTF/ChangeLog	2018-12-07 18:37:58 UTC (rev 238954)
+++ trunk/Source/WTF/ChangeLog	2018-12-07 18:40:31 UTC (rev 238955)
@@ -1,3 +1,15 @@
+2018-12-07  Andy Estes  <[email protected]>
+
+        [Cocoa] Add optional variants of SOFT_LINK_CLASS_FOR_SOURCE
+        https://bugs.webkit.org/show_bug.cgi?id=192498
+
+        Reviewed by Tim Horton.
+
+        Added SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL and SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT,
+        which behave like their non-optional variants but do not require their classes to exist.
+
+        * wtf/cocoa/SoftLinking.h:
+
 2018-12-06  Alexey Proskuryakov  <[email protected]>
 
         Move USE_NEW_THEME out of WebCore's config.h

Modified: trunk/Source/WTF/wtf/cocoa/SoftLinking.h (238954 => 238955)


--- trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2018-12-07 18:37:58 UTC (rev 238954)
+++ trunk/Source/WTF/wtf/cocoa/SoftLinking.h	2018-12-07 18:40:31 UTC (rev 238955)
@@ -389,7 +389,7 @@
     } \
     }
 
-#define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, className, export) \
+#define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, export, assertion) \
     @class className; \
     namespace functionNamespace { \
     static Class init##className(); \
@@ -407,7 +407,7 @@
         dispatch_once(&once, ^{ \
             framework##Library(); \
             class##className = objc_getClass(#className); \
-            RELEASE_ASSERT(class##className); \
+            assertion(class##className); \
             get##className##Class = className##Function; \
         }); \
         return class##className; \
@@ -414,9 +414,20 @@
     } \
     }
 
+#define NO_ASSERT(assertion) (void(0))
+
+#define SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, className, export) \
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, export, RELEASE_ASSERT)
+
+#define SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL_WITH_EXPORT(functionNamespace, framework, className, export) \
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, export, NO_ASSERT)
+
 #define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
-    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, className, )
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, , RELEASE_ASSERT)
 
+#define SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL(functionNamespace, framework, className) \
+    SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT_AND_ASSERTION(functionNamespace, framework, className, , NO_ASSERT)
+
 #define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
     WTF_EXTERN_C_BEGIN \
     extern const variableType variableName; \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to