<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[202122] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/202122">202122</a></dd>
<dt>Author</dt> <dd>ddkilzer@apple.com</dd>
<dt>Date</dt> <dd>2016-06-15 20:22:07 -0700 (Wed, 15 Jun 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move SoftLinking.h to platform/cococa from platform/mac
<https://webkit.org/b/158825>
Reviewed by Andy Estes.
* PlatformMac.cmake: Update for new directory.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* platform/cocoa/SoftLinking.h: Renamed from Source/WebCore/platform/mac/SoftLinking.h.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformcocoaSoftLinkingh">trunk/Source/WebCore/platform/cocoa/SoftLinking.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformmacSoftLinkingh">trunk/Source/WebCore/platform/mac/SoftLinking.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202121 => 202122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-16 02:59:54 UTC (rev 202121)
+++ trunk/Source/WebCore/ChangeLog        2016-06-16 03:22:07 UTC (rev 202122)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-06-15 David Kilzer <ddkilzer@apple.com>
+
+ Move SoftLinking.h to platform/cococa from platform/mac
+ <https://webkit.org/b/158825>
+
+ Reviewed by Andy Estes.
+
+ * PlatformMac.cmake: Update for new directory.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * platform/cocoa/SoftLinking.h: Renamed from Source/WebCore/platform/mac/SoftLinking.h.
+
</ins><span class="cx"> 2016-06-15 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [Cocoa] Clean up / optimize ResourceResponse::platformLazyInit(InitLevel)
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (202121 => 202122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2016-06-16 02:59:54 UTC (rev 202121)
+++ trunk/Source/WebCore/PlatformMac.cmake        2016-06-16 03:22:07 UTC (rev 202122)
</span><span class="lines">@@ -707,12 +707,12 @@
</span><span class="cx"> platform/cf/RunLoopObserver.h
</span><span class="cx">
</span><span class="cx"> platform/cocoa/MachSendRight.h
</span><ins>+ platform/cocoa/SoftLinking.h
</ins><span class="cx">
</span><span class="cx"> platform/graphics/cocoa/IOSurface.h
</span><span class="cx">
</span><span class="cx"> platform/graphics/transforms/AffineTransform.h
</span><span class="cx">
</span><del>- platform/mac/SoftLinking.h
</del><span class="cx"> platform/mac/WebCoreSystemInterface.h
</span><span class="cx">
</span><span class="cx"> platform/network/cf/CertificateInfo.h
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (202121 => 202122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-16 02:59:54 UTC (rev 202121)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-06-16 03:22:07 UTC (rev 202122)
</span><span class="lines">@@ -17923,7 +17923,6 @@
</span><span class="cx">                                 077AF14118F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h */,
</span><span class="cx">                                 077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */,
</span><span class="cx">                                 1A4A95510B4EDCFF002D8C3C /* SharedBufferMac.mm */,
</span><del>-                                0A4844980CA44CB200B7BD48 /* SoftLinking.h */,
</del><span class="cx">                                 4B3043C80AE0371D00A82647 /* SoundMac.mm */,
</span><span class="cx">                                 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.cpp */,
</span><span class="cx">                                 93B2D8170F9920EE006AE6B2 /* SuddenTermination.mm */,
</span><span class="lines">@@ -20095,6 +20094,7 @@
</span><span class="cx">                                 F478755319983AFF0024A287 /* ScrollSnapAnimatorState.mm */,
</span><span class="cx">                                 0E7058F31BC5CCD70045A507 /* SearchPopupMenuCocoa.h */,
</span><span class="cx">                                 0E7058ED1BC5BC190045A507 /* SearchPopupMenuCocoa.mm */,
</span><ins>+                                0A4844980CA44CB200B7BD48 /* SoftLinking.h */,
</ins><span class="cx">                                 5D5975B119635F1100D00878 /* SystemVersion.h */,
</span><span class="cx">                                 5D5975B219635F1100D00878 /* SystemVersion.mm */,
</span><span class="cx">                                 7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaSoftLinkinghfromrev202121trunkSourceWebCoreplatformmacSoftLinkingh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/SoftLinking.h (from rev 202121, trunk/Source/WebCore/platform/mac/SoftLinking.h) (0 => 202122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/SoftLinking.h         (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/SoftLinking.h        2016-06-16 03:22:07 UTC (rev 202122)
</span><span class="lines">@@ -0,0 +1,528 @@
</span><ins>+/*
+ * Copyright (C) 2007, 2008, 2011-2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SoftLinking_h
+#define SoftLinking_h
+
+#import <wtf/Assertions.h>
+#import <dlfcn.h>
+#import <objc/runtime.h>
+
+#pragma mark - Soft-link macros for use within a single source file
+
+#define SOFT_LINK_LIBRARY(lib) \
+ static void* lib##Library() \
+ { \
+ static void* dylib = ^{ \
+ void *result = dlopen("/usr/lib/" #lib ".dylib", RTLD_NOW); \
+ RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
+ return result; \
+ }(); \
+ return dylib; \
+ }
+
+#define SOFT_LINK_FRAMEWORK(framework) \
+ static void* framework##Library() \
+ { \
+ static void* frameworkLibrary = ^{ \
+ void* result = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
+ return result; \
+ }(); \
+ return frameworkLibrary; \
+ }
+
+#define SOFT_LINK_PRIVATE_FRAMEWORK(framework) \
+ static void* framework##Library() \
+ { \
+ static void* frameworkLibrary = ^{ \
+ void* result = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
+ return result; \
+ }(); \
+ return frameworkLibrary; \
+ }
+
+#define SOFT_LINK_FRAMEWORK_OPTIONAL(framework) \
+ static void* framework##Library() \
+ { \
+ static void* frameworkLibrary = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ return frameworkLibrary; \
+ }
+
+#define SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(framework) \
+ static void* framework##Library() \
+ { \
+ static void* frameworkLibrary = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ return frameworkLibrary; \
+ }
+
+#define SOFT_LINK_STAGED_FRAMEWORK(framework, unstagedLocation, version) \
+ static void* framework##Library() \
+ { \
+ static void* frameworkLibrary = ^{ \
+ void* result = dlopen("/System/Library/" #unstagedLocation "/" #framework ".framework/Versions/" #version "/" #framework, RTLD_LAZY); \
+ if (!result) \
+ result = dlopen("/System/Library/StagedFrameworks/Safari/" #framework ".framework/Versions/" #version "/" #framework, RTLD_LAZY); \
+ RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
+ return result; \
+ }(); \
+ return frameworkLibrary; \
+ }
+
+#define SOFT_LINK_FRAMEWORK_IN_UMBRELLA(umbrella, framework) \
+ static void* framework##Library() \
+ { \
+ static void* frameworkLibrary = ^{ \
+ void* result = dlopen("/System/Library/Frameworks/" #umbrella ".framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
+ return result; \
+ }(); \
+ return frameworkLibrary; \
+ }
+
+#define SOFT_LINK(framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ static resultType init##functionName parameterDeclarations; \
+ static resultType (*softLink##functionName) parameterDeclarations = init##functionName; \
+ \
+ static resultType init##functionName parameterDeclarations \
+ { \
+ softLink##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
+ RELEASE_ASSERT_WITH_MESSAGE(softLink##functionName, "%s", dlerror()); \
+ return softLink##functionName parameterNames; \
+ } \
+ \
+ inline resultType functionName parameterDeclarations \
+ { \
+ return softLink##functionName parameterNames; \
+ }
+
+#define SOFT_LINK_MAY_FAIL(framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ static resultType (*softLink##functionName) parameterDeclarations = 0; \
+ \
+ static bool init##functionName() \
+ { \
+ ASSERT(!softLink##functionName); \
+ softLink##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
+ return !!softLink##functionName; \
+ } \
+ \
+ static bool canLoad##functionName() \
+ { \
+ static bool loaded = init##functionName(); \
+ return loaded; \
+ } \
+ \
+ __attribute__((visibility("hidden"))) resultType functionName parameterDeclarations \
+ { \
+ ASSERT(softLink##functionName); \
+ return softLink##functionName parameterNames; \
+ }
+
+/* callingConvention is unused on Mac but is here to keep the macro prototype the same between Mac and Windows. */
+#define SOFT_LINK_OPTIONAL(framework, functionName, resultType, callingConvention, parameterDeclarations) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ typedef resultType (*functionName##PtrType) parameterDeclarations; \
+ \
+ static functionName##PtrType functionName##Ptr() \
+ { \
+ static functionName##PtrType ptr = reinterpret_cast<functionName##PtrType>(dlsym(framework##Library(), #functionName)); \
+ return ptr; \
+ }
+
+#define SOFT_LINK_CLASS(framework, className) \
+ @class className; \
+ static Class init##className(); \
+ static Class (*get##className##Class)() = init##className; \
+ static Class class##className; \
+ \
+ static Class className##Function() \
+ { \
+ return class##className; \
+ } \
+ \
+ static Class init##className() \
+ { \
+ framework##Library(); \
+ class##className = objc_getClass(#className); \
+ RELEASE_ASSERT(class##className); \
+ get##className##Class = className##Function; \
+ return class##className; \
+ } \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
+ static className *alloc##className##Instance() \
+ { \
+ return [get##className##Class() alloc]; \
+ } \
+ _Pragma("clang diagnostic pop")
+
+#define SOFT_LINK_CLASS_OPTIONAL(framework, className) \
+ @class className; \
+ static Class init##className(); \
+ static Class (*get##className##Class)() = init##className; \
+ static Class class##className; \
+ \
+ static Class className##Function() \
+ { \
+ return class##className; \
+ } \
+ \
+ static Class init##className() \
+ { \
+ framework##Library(); \
+ class##className = objc_getClass(#className); \
+ get##className##Class = className##Function; \
+ return class##className; \
+ } \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
+ static className *alloc##className##Instance() \
+ { \
+ return [get##className##Class() alloc]; \
+ } \
+ _Pragma("clang diagnostic pop")
+
+#define SOFT_LINK_POINTER(framework, name, type) \
+ static type init##name(); \
+ static type (*get##name)() = init##name; \
+ static type pointer##name; \
+ \
+ static type name##Function() \
+ { \
+ return pointer##name; \
+ } \
+ \
+ static type init##name() \
+ { \
+ void** pointer = static_cast<void**>(dlsym(framework##Library(), #name)); \
+ RELEASE_ASSERT_WITH_MESSAGE(pointer, "%s", dlerror()); \
+ pointer##name = static_cast<type>(*pointer); \
+ get##name = name##Function; \
+ return pointer##name; \
+ }
+
+#define SOFT_LINK_POINTER_OPTIONAL(framework, name, type) \
+ static type init##name(); \
+ static type (*get##name)() = init##name; \
+ static type pointer##name; \
+ \
+ static type name##Function() \
+ { \
+ return pointer##name; \
+ } \
+ \
+ static type init##name() \
+ { \
+ void** pointer = static_cast<void**>(dlsym(framework##Library(), #name)); \
+ if (pointer) \
+ pointer##name = static_cast<type>(*pointer); \
+ get##name = name##Function; \
+ return pointer##name; \
+ }
+
+#define SOFT_LINK_CONSTANT(framework, name, type) \
+ static type init##name(); \
+ static type (*get##name)() = init##name; \
+ static type constant##name; \
+ \
+ static type name##Function() \
+ { \
+ return constant##name; \
+ } \
+ \
+ static type init##name() \
+ { \
+ void* constant = dlsym(framework##Library(), #name); \
+ RELEASE_ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \
+ constant##name = *static_cast<type*>(constant); \
+ get##name = name##Function; \
+ return constant##name; \
+ }
+
+#define SOFT_LINK_CONSTANT_MAY_FAIL(framework, name, type) \
+ static bool init##name(); \
+ static type (*get##name)() = 0; \
+ static type constant##name; \
+ \
+ static type name##Function() \
+ { \
+ return constant##name; \
+ } \
+ \
+ static bool canLoad##name() \
+ { \
+ static bool loaded = init##name(); \
+ return loaded; \
+ } \
+ \
+ static bool init##name() \
+ { \
+ ASSERT(!get##name); \
+ void* constant = dlsym(framework##Library(), #name); \
+ if (!constant) \
+ return false; \
+ constant##name = *static_cast<type*>(constant); \
+ get##name = name##Function; \
+ return true; \
+ }
+
+#pragma mark - Soft-link macros for sharing across multiple source files
+
+// See Source/WebCore/platform/cf/CoreMediaSoftLink.{cpp,h} for an example implementation.
+
+#define SOFT_LINK_FRAMEWORK_FOR_HEADER(functionNamespace, framework) \
+ namespace functionNamespace { \
+ extern void* framework##Library(bool isOptional = false); \
+ bool is##framework##FrameworkAvailable(); \
+ inline bool is##framework##FrameworkAvailable() { \
+ return framework##Library(true) != nullptr; \
+ } \
+ }
+
+#define SOFT_LINK_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+ namespace functionNamespace { \
+ void* framework##Library(bool isOptional = false); \
+ void* framework##Library(bool isOptional) \
+ { \
+ static void* frameworkLibrary; \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ frameworkLibrary = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+ if (!isOptional) \
+ RELEASE_ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \
+ }); \
+ return frameworkLibrary; \
+ } \
+ }
+
+#define SOFT_LINK_CLASS_FOR_HEADER(functionNamespace, framework, className) \
+ @class className; \
+ namespace functionNamespace { \
+ extern Class (*get_##framework##_##className##Class)(); \
+ className *alloc##className##Instance(); \
+ inline className *alloc##className##Instance() \
+ { \
+ return [get_##framework##_##className##Class() alloc]; \
+ } \
+ }
+
+#define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
+ @class className; \
+ namespace functionNamespace { \
+ static Class init##className(); \
+ Class (*get_##framework##_##className##Class)() = init##className; \
+ static Class class##className; \
+ \
+ static Class className##Function() \
+ { \
+ return class##className; \
+ } \
+ \
+ static Class init##className() \
+ { \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ framework##Library(); \
+ class##className = objc_getClass(#className); \
+ RELEASE_ASSERT(class##className); \
+ get_##framework##_##className##Class = className##Function; \
+ }); \
+ return class##className; \
+ } \
+ }
+
+#define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
+ WTF_EXTERN_C_BEGIN \
+ extern const variableType variableName; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ variableType get_##framework##_##variableName(); \
+ }
+
+#define SOFT_LINK_CONSTANT_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
+ WTF_EXTERN_C_BEGIN \
+ extern const variableType variableName; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ variableType get_##framework##_##variableName(); \
+ variableType get_##framework##_##variableName() \
+ { \
+ static variableType constant##framework##variableName; \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ void* constant = dlsym(framework##Library(), #variableName); \
+ RELEASE_ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \
+ constant##framework##variableName = *static_cast<variableType*>(constant); \
+ }); \
+ return constant##framework##variableName; \
+ } \
+ }
+
+#define SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
+ WTF_EXTERN_C_BEGIN \
+ extern const variableType variableName; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ bool canLoad_##framework##_##variableName(); \
+ bool init_##framework##_##variableName(); \
+ variableType get_##framework##_##variableName(); \
+ }
+
+#define SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
+ WTF_EXTERN_C_BEGIN \
+ extern const variableType variableName; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ static variableType constant##framework##variableName; \
+ bool init_##framework##_##variableName(); \
+ bool init_##framework##_##variableName() \
+ { \
+ void* constant = dlsym(framework##Library(), #variableName); \
+ if (!constant) \
+ return false; \
+ constant##framework##variableName = *static_cast<variableType*>(constant); \
+ return true; \
+ } \
+ bool canLoad_##framework##_##variableName(); \
+ bool canLoad_##framework##_##variableName() \
+ { \
+ static bool loaded = init_##framework##_##variableName(); \
+ return loaded; \
+ } \
+ variableType get_##framework##_##variableName(); \
+ variableType get_##framework##_##variableName() \
+ { \
+ return constant##framework##variableName; \
+ } \
+ }
+
+#define SOFT_LINK_FUNCTION_FOR_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ extern resultType (*softLink##framework##functionName) parameterDeclarations; \
+ inline resultType softLink_##framework##_##functionName parameterDeclarations \
+ { \
+ return softLink##framework##functionName parameterNames; \
+ } \
+ }
+
+#define SOFT_LINK_FUNCTION_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ static resultType init##framework##functionName parameterDeclarations; \
+ resultType (*softLink##framework##functionName) parameterDeclarations = init##framework##functionName; \
+ static resultType init##framework##functionName parameterDeclarations \
+ { \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ softLink##framework##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
+ RELEASE_ASSERT_WITH_MESSAGE(softLink##framework##functionName, "%s", dlerror()); \
+ }); \
+ return softLink##framework##functionName parameterNames; \
+ } \
+ }
+
+#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ extern resultType (*softLink##framework##functionName) parameterDeclarations; \
+ bool canLoad_##framework##_##functionName(); \
+ bool init_##framework##_##functionName(); \
+ resultType softLink_##framework##_##functionName parameterDeclarations; \
+ }
+
+#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ WTF_EXTERN_C_BEGIN \
+ resultType functionName parameterDeclarations; \
+ WTF_EXTERN_C_END \
+ namespace functionNamespace { \
+ resultType (*softLink##framework##functionName) parameterDeclarations = 0; \
+ bool init_##framework##_##functionName(); \
+ bool init_##framework##_##functionName() \
+ { \
+ ASSERT(!softLink##framework##functionName); \
+ softLink##framework##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
+ return !!softLink##framework##functionName; \
+ } \
+ \
+ bool canLoad_##framework##_##functionName(); \
+ bool canLoad_##framework##_##functionName() \
+ { \
+ static bool loaded = init_##framework##_##functionName(); \
+ return loaded; \
+ } \
+ \
+ resultType softLink_##framework##_##functionName parameterDeclarations; \
+ resultType softLink_##framework##_##functionName parameterDeclarations \
+ { \
+ ASSERT(softLink##framework##functionName); \
+ return softLink##framework##functionName parameterNames; \
+ } \
+ }
+
+#define SOFT_LINK_POINTER_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
+ namespace functionNamespace { \
+ extern variableType (*get_##framework##_##variableName)(); \
+ }
+
+#define SOFT_LINK_POINTER_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
+ namespace functionNamespace { \
+ static variableType init##framework##variableName(); \
+ variableType (*get_##framework##_##variableName)() = init##framework##variableName; \
+ static variableType pointer##framework##variableName; \
+ \
+ static variableType pointer##framework##variableName##Function() \
+ { \
+ return pointer##framework##variableName; \
+ } \
+ \
+ static variableType init##framework##variableName() \
+ { \
+ static dispatch_once_t once; \
+ dispatch_once(&once, ^{ \
+ void** pointer = static_cast<void**>(dlsym(framework##Library(), #variableName)); \
+ RELEASE_ASSERT_WITH_MESSAGE(pointer, "%s", dlerror()); \
+ pointer##framework##variableName = static_cast<variableType>(*pointer); \
+ get_##framework##_##variableName = pointer##framework##variableName##Function; \
+ }); \
+ return pointer##framework##variableName; \
+ } \
+ }
+
+#endif // SoftLinking_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformmacSoftLinkingh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/SoftLinking.h (202121 => 202122)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/SoftLinking.h        2016-06-16 02:59:54 UTC (rev 202121)
+++ trunk/Source/WebCore/platform/mac/SoftLinking.h        2016-06-16 03:22:07 UTC (rev 202122)
</span><span class="lines">@@ -1,528 +0,0 @@
</span><del>-/*
- * Copyright (C) 2007, 2008, 2011-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SoftLinking_h
-#define SoftLinking_h
-
-#import <wtf/Assertions.h>
-#import <dlfcn.h>
-#import <objc/runtime.h>
-
-#pragma mark - Soft-link macros for use within a single source file
-
-#define SOFT_LINK_LIBRARY(lib) \
- static void* lib##Library() \
- { \
- static void* dylib = ^{ \
- void *result = dlopen("/usr/lib/" #lib ".dylib", RTLD_NOW); \
- RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
- return result; \
- }(); \
- return dylib; \
- }
-
-#define SOFT_LINK_FRAMEWORK(framework) \
- static void* framework##Library() \
- { \
- static void* frameworkLibrary = ^{ \
- void* result = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
- RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
- return result; \
- }(); \
- return frameworkLibrary; \
- }
-
-#define SOFT_LINK_PRIVATE_FRAMEWORK(framework) \
- static void* framework##Library() \
- { \
- static void* frameworkLibrary = ^{ \
- void* result = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
- RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
- return result; \
- }(); \
- return frameworkLibrary; \
- }
-
-#define SOFT_LINK_FRAMEWORK_OPTIONAL(framework) \
- static void* framework##Library() \
- { \
- static void* frameworkLibrary = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
- return frameworkLibrary; \
- }
-
-#define SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(framework) \
- static void* framework##Library() \
- { \
- static void* frameworkLibrary = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
- return frameworkLibrary; \
- }
-
-#define SOFT_LINK_STAGED_FRAMEWORK(framework, unstagedLocation, version) \
- static void* framework##Library() \
- { \
- static void* frameworkLibrary = ^{ \
- void* result = dlopen("/System/Library/" #unstagedLocation "/" #framework ".framework/Versions/" #version "/" #framework, RTLD_LAZY); \
- if (!result) \
- result = dlopen("/System/Library/StagedFrameworks/Safari/" #framework ".framework/Versions/" #version "/" #framework, RTLD_LAZY); \
- RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
- return result; \
- }(); \
- return frameworkLibrary; \
- }
-
-#define SOFT_LINK_FRAMEWORK_IN_UMBRELLA(umbrella, framework) \
- static void* framework##Library() \
- { \
- static void* frameworkLibrary = ^{ \
- void* result = dlopen("/System/Library/Frameworks/" #umbrella ".framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
- RELEASE_ASSERT_WITH_MESSAGE(result, "%s", dlerror()); \
- return result; \
- }(); \
- return frameworkLibrary; \
- }
-
-#define SOFT_LINK(framework, functionName, resultType, parameterDeclarations, parameterNames) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- static resultType init##functionName parameterDeclarations; \
- static resultType (*softLink##functionName) parameterDeclarations = init##functionName; \
- \
- static resultType init##functionName parameterDeclarations \
- { \
- softLink##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
- RELEASE_ASSERT_WITH_MESSAGE(softLink##functionName, "%s", dlerror()); \
- return softLink##functionName parameterNames; \
- } \
- \
- inline resultType functionName parameterDeclarations \
- { \
- return softLink##functionName parameterNames; \
- }
-
-#define SOFT_LINK_MAY_FAIL(framework, functionName, resultType, parameterDeclarations, parameterNames) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- static resultType (*softLink##functionName) parameterDeclarations = 0; \
- \
- static bool init##functionName() \
- { \
- ASSERT(!softLink##functionName); \
- softLink##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
- return !!softLink##functionName; \
- } \
- \
- static bool canLoad##functionName() \
- { \
- static bool loaded = init##functionName(); \
- return loaded; \
- } \
- \
- __attribute__((visibility("hidden"))) resultType functionName parameterDeclarations \
- { \
- ASSERT(softLink##functionName); \
- return softLink##functionName parameterNames; \
- }
-
-/* callingConvention is unused on Mac but is here to keep the macro prototype the same between Mac and Windows. */
-#define SOFT_LINK_OPTIONAL(framework, functionName, resultType, callingConvention, parameterDeclarations) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- typedef resultType (*functionName##PtrType) parameterDeclarations; \
- \
- static functionName##PtrType functionName##Ptr() \
- { \
- static functionName##PtrType ptr = reinterpret_cast<functionName##PtrType>(dlsym(framework##Library(), #functionName)); \
- return ptr; \
- }
-
-#define SOFT_LINK_CLASS(framework, className) \
- @class className; \
- static Class init##className(); \
- static Class (*get##className##Class)() = init##className; \
- static Class class##className; \
- \
- static Class className##Function() \
- { \
- return class##className; \
- } \
- \
- static Class init##className() \
- { \
- framework##Library(); \
- class##className = objc_getClass(#className); \
- RELEASE_ASSERT(class##className); \
- get##className##Class = className##Function; \
- return class##className; \
- } \
- _Pragma("clang diagnostic push") \
- _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
- static className *alloc##className##Instance() \
- { \
- return [get##className##Class() alloc]; \
- } \
- _Pragma("clang diagnostic pop")
-
-#define SOFT_LINK_CLASS_OPTIONAL(framework, className) \
- @class className; \
- static Class init##className(); \
- static Class (*get##className##Class)() = init##className; \
- static Class class##className; \
- \
- static Class className##Function() \
- { \
- return class##className; \
- } \
- \
- static Class init##className() \
- { \
- framework##Library(); \
- class##className = objc_getClass(#className); \
- get##className##Class = className##Function; \
- return class##className; \
- } \
- _Pragma("clang diagnostic push") \
- _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
- static className *alloc##className##Instance() \
- { \
- return [get##className##Class() alloc]; \
- } \
- _Pragma("clang diagnostic pop")
-
-#define SOFT_LINK_POINTER(framework, name, type) \
- static type init##name(); \
- static type (*get##name)() = init##name; \
- static type pointer##name; \
- \
- static type name##Function() \
- { \
- return pointer##name; \
- } \
- \
- static type init##name() \
- { \
- void** pointer = static_cast<void**>(dlsym(framework##Library(), #name)); \
- RELEASE_ASSERT_WITH_MESSAGE(pointer, "%s", dlerror()); \
- pointer##name = static_cast<type>(*pointer); \
- get##name = name##Function; \
- return pointer##name; \
- }
-
-#define SOFT_LINK_POINTER_OPTIONAL(framework, name, type) \
- static type init##name(); \
- static type (*get##name)() = init##name; \
- static type pointer##name; \
- \
- static type name##Function() \
- { \
- return pointer##name; \
- } \
- \
- static type init##name() \
- { \
- void** pointer = static_cast<void**>(dlsym(framework##Library(), #name)); \
- if (pointer) \
- pointer##name = static_cast<type>(*pointer); \
- get##name = name##Function; \
- return pointer##name; \
- }
-
-#define SOFT_LINK_CONSTANT(framework, name, type) \
- static type init##name(); \
- static type (*get##name)() = init##name; \
- static type constant##name; \
- \
- static type name##Function() \
- { \
- return constant##name; \
- } \
- \
- static type init##name() \
- { \
- void* constant = dlsym(framework##Library(), #name); \
- RELEASE_ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \
- constant##name = *static_cast<type*>(constant); \
- get##name = name##Function; \
- return constant##name; \
- }
-
-#define SOFT_LINK_CONSTANT_MAY_FAIL(framework, name, type) \
- static bool init##name(); \
- static type (*get##name)() = 0; \
- static type constant##name; \
- \
- static type name##Function() \
- { \
- return constant##name; \
- } \
- \
- static bool canLoad##name() \
- { \
- static bool loaded = init##name(); \
- return loaded; \
- } \
- \
- static bool init##name() \
- { \
- ASSERT(!get##name); \
- void* constant = dlsym(framework##Library(), #name); \
- if (!constant) \
- return false; \
- constant##name = *static_cast<type*>(constant); \
- get##name = name##Function; \
- return true; \
- }
-
-#pragma mark - Soft-link macros for sharing across multiple source files
-
-// See Source/WebCore/platform/cf/CoreMediaSoftLink.{cpp,h} for an example implementation.
-
-#define SOFT_LINK_FRAMEWORK_FOR_HEADER(functionNamespace, framework) \
- namespace functionNamespace { \
- extern void* framework##Library(bool isOptional = false); \
- bool is##framework##FrameworkAvailable(); \
- inline bool is##framework##FrameworkAvailable() { \
- return framework##Library(true) != nullptr; \
- } \
- }
-
-#define SOFT_LINK_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
- namespace functionNamespace { \
- void* framework##Library(bool isOptional = false); \
- void* framework##Library(bool isOptional) \
- { \
- static void* frameworkLibrary; \
- static dispatch_once_t once; \
- dispatch_once(&once, ^{ \
- frameworkLibrary = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
- if (!isOptional) \
- RELEASE_ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \
- }); \
- return frameworkLibrary; \
- } \
- }
-
-#define SOFT_LINK_CLASS_FOR_HEADER(functionNamespace, framework, className) \
- @class className; \
- namespace functionNamespace { \
- extern Class (*get_##framework##_##className##Class)(); \
- className *alloc##className##Instance(); \
- inline className *alloc##className##Instance() \
- { \
- return [get_##framework##_##className##Class() alloc]; \
- } \
- }
-
-#define SOFT_LINK_CLASS_FOR_SOURCE(functionNamespace, framework, className) \
- @class className; \
- namespace functionNamespace { \
- static Class init##className(); \
- Class (*get_##framework##_##className##Class)() = init##className; \
- static Class class##className; \
- \
- static Class className##Function() \
- { \
- return class##className; \
- } \
- \
- static Class init##className() \
- { \
- static dispatch_once_t once; \
- dispatch_once(&once, ^{ \
- framework##Library(); \
- class##className = objc_getClass(#className); \
- RELEASE_ASSERT(class##className); \
- get_##framework##_##className##Class = className##Function; \
- }); \
- return class##className; \
- } \
- }
-
-#define SOFT_LINK_CONSTANT_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
- WTF_EXTERN_C_BEGIN \
- extern const variableType variableName; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- variableType get_##framework##_##variableName(); \
- }
-
-#define SOFT_LINK_CONSTANT_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
- WTF_EXTERN_C_BEGIN \
- extern const variableType variableName; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- variableType get_##framework##_##variableName(); \
- variableType get_##framework##_##variableName() \
- { \
- static variableType constant##framework##variableName; \
- static dispatch_once_t once; \
- dispatch_once(&once, ^{ \
- void* constant = dlsym(framework##Library(), #variableName); \
- RELEASE_ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \
- constant##framework##variableName = *static_cast<variableType*>(constant); \
- }); \
- return constant##framework##variableName; \
- } \
- }
-
-#define SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
- WTF_EXTERN_C_BEGIN \
- extern const variableType variableName; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- bool canLoad_##framework##_##variableName(); \
- bool init_##framework##_##variableName(); \
- variableType get_##framework##_##variableName(); \
- }
-
-#define SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
- WTF_EXTERN_C_BEGIN \
- extern const variableType variableName; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- static variableType constant##framework##variableName; \
- bool init_##framework##_##variableName(); \
- bool init_##framework##_##variableName() \
- { \
- void* constant = dlsym(framework##Library(), #variableName); \
- if (!constant) \
- return false; \
- constant##framework##variableName = *static_cast<variableType*>(constant); \
- return true; \
- } \
- bool canLoad_##framework##_##variableName(); \
- bool canLoad_##framework##_##variableName() \
- { \
- static bool loaded = init_##framework##_##variableName(); \
- return loaded; \
- } \
- variableType get_##framework##_##variableName(); \
- variableType get_##framework##_##variableName() \
- { \
- return constant##framework##variableName; \
- } \
- }
-
-#define SOFT_LINK_FUNCTION_FOR_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- extern resultType (*softLink##framework##functionName) parameterDeclarations; \
- inline resultType softLink_##framework##_##functionName parameterDeclarations \
- { \
- return softLink##framework##functionName parameterNames; \
- } \
- }
-
-#define SOFT_LINK_FUNCTION_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- static resultType init##framework##functionName parameterDeclarations; \
- resultType (*softLink##framework##functionName) parameterDeclarations = init##framework##functionName; \
- static resultType init##framework##functionName parameterDeclarations \
- { \
- static dispatch_once_t once; \
- dispatch_once(&once, ^{ \
- softLink##framework##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
- RELEASE_ASSERT_WITH_MESSAGE(softLink##framework##functionName, "%s", dlerror()); \
- }); \
- return softLink##framework##functionName parameterNames; \
- } \
- }
-
-#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- extern resultType (*softLink##framework##functionName) parameterDeclarations; \
- bool canLoad_##framework##_##functionName(); \
- bool init_##framework##_##functionName(); \
- resultType softLink_##framework##_##functionName parameterDeclarations; \
- }
-
-#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
- WTF_EXTERN_C_BEGIN \
- resultType functionName parameterDeclarations; \
- WTF_EXTERN_C_END \
- namespace functionNamespace { \
- resultType (*softLink##framework##functionName) parameterDeclarations = 0; \
- bool init_##framework##_##functionName(); \
- bool init_##framework##_##functionName() \
- { \
- ASSERT(!softLink##framework##functionName); \
- softLink##framework##functionName = (resultType (*) parameterDeclarations) dlsym(framework##Library(), #functionName); \
- return !!softLink##framework##functionName; \
- } \
- \
- bool canLoad_##framework##_##functionName(); \
- bool canLoad_##framework##_##functionName() \
- { \
- static bool loaded = init_##framework##_##functionName(); \
- return loaded; \
- } \
- \
- resultType softLink_##framework##_##functionName parameterDeclarations; \
- resultType softLink_##framework##_##functionName parameterDeclarations \
- { \
- ASSERT(softLink##framework##functionName); \
- return softLink##framework##functionName parameterNames; \
- } \
- }
-
-#define SOFT_LINK_POINTER_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
- namespace functionNamespace { \
- extern variableType (*get_##framework##_##variableName)(); \
- }
-
-#define SOFT_LINK_POINTER_FOR_SOURCE(functionNamespace, framework, variableName, variableType) \
- namespace functionNamespace { \
- static variableType init##framework##variableName(); \
- variableType (*get_##framework##_##variableName)() = init##framework##variableName; \
- static variableType pointer##framework##variableName; \
- \
- static variableType pointer##framework##variableName##Function() \
- { \
- return pointer##framework##variableName; \
- } \
- \
- static variableType init##framework##variableName() \
- { \
- static dispatch_once_t once; \
- dispatch_once(&once, ^{ \
- void** pointer = static_cast<void**>(dlsym(framework##Library(), #variableName)); \
- RELEASE_ASSERT_WITH_MESSAGE(pointer, "%s", dlerror()); \
- pointer##framework##variableName = static_cast<variableType>(*pointer); \
- get_##framework##_##variableName = pointer##framework##variableName##Function; \
- }); \
- return pointer##framework##variableName; \
- } \
- }
-
-#endif // SoftLinking_h
</del></span></pre>
</div>
</div>
</body>
</html>