Changeset 180481 in webkit
- Timestamp:
- Feb 21, 2015 1:49:57 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r180476 r180481 1 2015-02-21 David Kilzer <ddkilzer@apple.com> 2 3 Add SOFT_LINK_CONSTANT_SOURCE() cross-platform macro and start using it 4 <http://webkit.org/b/141816> 5 6 Reviewed by Alexey Proskuryakov. 7 8 * WebCore.vcxproj/WebCore.vcxproj: 9 * WebCore.vcxproj/WebCore.vcxproj.filters: 10 - Remove CoreMediaSoftLinking.h. 11 12 * platform/cf/CoreMediaSoftLink.cpp: 13 - Add kCMTimeZero constant. 14 * platform/cf/CoreMediaSoftLink.h: 15 - Add SOFT_LINK_FRAMEWORK_HEADER() macro for CoreMedia. 16 - Add kCMTimeZero constant. 17 18 * platform/graphics/avfoundation/cf/CoreMediaSoftLinking.h: Remove. 19 20 * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: 21 - Remove reference to CoreMediaSoftLinking.h and update comment. 22 (WebCore::MediaPlayerPrivateAVFoundationCF::isAvailable): 23 - Switch to using new method to check if a framework is 24 available. 25 26 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 27 - Remove all local soft-linking macros for CoreMedia. 28 CoreMediaSoftLink.h handles everything now. 29 (WebCore::MediaPlayerPrivateAVFoundationObjC::isAvailable): 30 - Switch to using new method to check if a framework is 31 available. 32 33 * platform/mac/SoftLinking.h: 34 (SOFT_LINK_FRAMEWORK_HEADER): Add. Defines 35 is_Name_FrameworkAvailable() macro. 36 (SOFT_LINK_FRAMEWORK_SOURCE): Update to make it work with 37 optional framework checks without a separate macro. 38 (SOFT_LINK_CONSTANT_HEADER): Add. 39 (SOFT_LINK_CONSTANT_SOURCE): Add. 40 - Support soft-links to constants. 41 42 * platform/win/SoftLinking.h: 43 (SOFT_LINK_FRAMEWORK_HELPER): Add. Copied from 44 SOFT_LINK_LIBRARY_HELPER, with addition of namespace and 45 non-static function. 46 (SOFT_LINK_FRAMEWORK): Add. Copied from SOFT_LINK_LIBRARY. 47 (SOFT_LINK_DEBUG_FRAMEWORK): Add. Copied from 48 SOFT_LINK_DEBUG_LIBRARY. 49 (SOFT_LINK_FRAMEWORK_HEADER): Add. Defines 50 is_Name_FrameworkAvailable() macro. 51 (SOFT_LINK_FRAMEWORK_SOURCE): Redefine in terms of 52 SOFT_LINK_FRAMEWORK/SOFT_LINK_DEBUG_FRAMEWORK. 53 (SOFT_LINK_CONSTANT_HEADER): Add. 54 (SOFT_LINK_CONSTANT_SOURCE): Add. 55 - Support soft-links to constants. 56 1 57 2015-02-20 David Kilzer <ddkilzer@apple.com> 2 58 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r180294 r180481 20003 20003 <ClInclude Include="..\platform\graphics\avfoundation\MediaTimeAVFoundation.h" /> 20004 20004 <ClInclude Include="..\platform\graphics\avfoundation\cf\AVFoundationCFSoftLinking.h" /> 20005 <ClInclude Include="..\platform\graphics\avfoundation\cf\CoreMediaSoftLinking.h" />20006 20005 <ClInclude Include="..\platform\graphics\avfoundation\cf\MediaPlayerPrivateAVFoundationCF.h" /> 20007 20006 <ClInclude Include="..\platform\network\AuthenticationChallengeBase.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r180366 r180481 8692 8692 <Filter>platform\graphics\avfoundation\cf</Filter> 8693 8693 </ClInclude> 8694 <ClInclude Include="..\platform\graphics\avfoundation\cf\CoreMediaSoftLinking.h">8695 <Filter>platform\graphics\avfoundation\cf</Filter>8696 </ClInclude>8697 8694 <ClInclude Include="..\platform\graphics\avfoundation\cf\MediaPlayerPrivateAVFoundationCF.h"> 8698 8695 <Filter>platform\graphics\avfoundation\cf</Filter> -
trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp
r180476 r180481 40 40 SOFT_LINK_FUNCTION_SOURCE(WebCore, CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range)) 41 41 42 SOFT_LINK_CONSTANT_SOURCE(WebCore, CoreMedia, kCMTimeZero, CMTime); 43 42 44 #if PLATFORM(COCOA) 43 45 SOFT_LINK_FUNCTION_SOURCE(WebCore, CoreMedia, CMNotificationCenterGetDefaultLocalCenter, CMNotificationCenterRef, (void), ()); -
trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h
r180476 r180481 33 33 #include <CoreMedia/CoreMedia.h> 34 34 35 SOFT_LINK_FRAMEWORK_HEADER(WebCore, CoreMedia) 36 35 37 SOFT_LINK_FUNCTION_HEADER(WebCore, CoreMedia, CMTimeCompare, int32_t, (CMTime time1, CMTime time2), (time1, time2)) 36 38 #define CMTimeCompare softLink_CoreMedia_CMTimeCompare … … 43 45 SOFT_LINK_FUNCTION_HEADER(WebCore, CoreMedia, CMTimeRangeGetEnd, CMTime, (CMTimeRange range), (range)) 44 46 #define CMTimeRangeGetEnd softLink_CoreMedia_CMTimeRangeGetEnd 47 48 SOFT_LINK_CONSTANT_HEADER(WebCore, CoreMedia, kCMTimeZero, CMTime); 49 #define kCMTimeZero get_CoreMedia_kCMTimeZero() 45 50 46 51 #if PLATFORM(COCOA) -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
r180406 r180481 72 72 #include <wtf/StringPrintStream.h> 73 73 74 // The softlink header files must be included after the AVCF and CoreMedia header files.74 // Soft-linking headers must be included last since they #define functions, constants, etc. 75 75 #include "AVFoundationCFSoftLinking.h" 76 76 #include "CoreMediaSoftLink.h" 77 #include "CoreMediaSoftLinking.h"78 77 79 78 // We don't bother softlinking against libdispatch since it's already been loaded by AAS. … … 941 940 bool MediaPlayerPrivateAVFoundationCF::isAvailable() 942 941 { 943 return AVFoundationCFLibrary() && CoreMediaLibrary();942 return AVFoundationCFLibrary() && isCoreMediaFrameworkAvailable(); 944 943 } 945 944 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r180416 r180481 36 36 #import "CDMSessionAVFoundationObjC.h" 37 37 #import "Cookie.h" 38 #import "CoreMediaSoftLink.h"39 38 #import "ExceptionCodePlaceholder.h" 40 39 #import "FloatConversion.h" … … 146 145 typedef AVMediaSelectionOption AVMediaSelectionOptionType; 147 146 147 #pragma mark - Soft Linking 148 149 // Soft-linking headers must be included last since they #define functions, constants, etc. 150 #import "CoreMediaSoftLink.h" 151 148 152 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) 149 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia)150 153 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreImage) 151 154 SOFT_LINK_FRAMEWORK_OPTIONAL(CoreVideo) … … 196 199 197 200 SOFT_LINK_POINTER_OPTIONAL(AVFoundation, AVURLAssetClientBundleIdentifierKey, NSString *) 198 199 SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime)200 201 201 202 #define AVPlayer getAVPlayerClass() … … 284 285 #if PLATFORM(IOS) 285 286 SOFT_LINK_POINTER(AVFoundation, AVURLAssetBoundNetworkInterfaceName, NSString *) 286 287 287 #define AVURLAssetBoundNetworkInterfaceName getAVURLAssetBoundNetworkInterfaceName() 288 288 #endif 289 290 #define kCMTimeZero getkCMTimeZero()291 289 292 290 using namespace WebCore; … … 1755 1753 bool MediaPlayerPrivateAVFoundationObjC::isAvailable() 1756 1754 { 1757 return AVFoundationLibrary() && CoreMediaLibrary();1755 return AVFoundationLibrary() && isCoreMediaFrameworkAvailable(); 1758 1756 } 1759 1757 -
trunk/Source/WebCore/platform/mac/SoftLinking.h
r180476 r180481 294 294 // See Source/WebCore/platform/cf/CoreMediaSoftLink.{cpp,h} for an example implementation. 295 295 296 #define SOFT_LINK_FRAMEWORK_HEADER(functionNamespace, framework) \ 297 namespace functionNamespace { \ 298 extern void* framework##Library(bool isOptional = false); \ 299 bool is##framework##FrameworkAvailable(); \ 300 inline bool is##framework##FrameworkAvailable() { \ 301 return framework##Library(true) != nullptr; \ 302 } \ 303 } 304 296 305 #define SOFT_LINK_FRAMEWORK_SOURCE(functionNamespace, framework) \ 297 306 namespace functionNamespace { \ 298 static void* framework##Library() \ 307 void* framework##Library(bool isOptional = false); \ 308 void* framework##Library(bool isOptional) \ 299 309 { \ 300 310 static void* frameworkLibrary; \ … … 302 312 dispatch_once(&once, ^{ \ 303 313 frameworkLibrary = dlopen("/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \ 304 ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \305 314 }); \ 306 return frameworkLibrary; \ 315 ASSERT_WITH_MESSAGE_UNUSED(isOptional, isOptional || frameworkLibrary, "%s", dlerror()); \ 316 return frameworkLibrary; \ 317 } \ 318 } 319 320 #define SOFT_LINK_CONSTANT_HEADER(functionNamespace, framework, variableName, variableType) \ 321 WTF_EXTERN_C_BEGIN \ 322 extern const variableType variableName; \ 323 WTF_EXTERN_C_END \ 324 namespace functionNamespace { \ 325 const variableType get_##framework##_##variableName(); \ 326 } 327 328 #define SOFT_LINK_CONSTANT_SOURCE(functionNamespace, framework, variableName, variableType) \ 329 WTF_EXTERN_C_BEGIN \ 330 extern const variableType variableName; \ 331 WTF_EXTERN_C_END \ 332 namespace functionNamespace { \ 333 const variableType get_##framework##_##variableName(); \ 334 const variableType get_##framework##_##variableName() \ 335 { \ 336 static variableType constant##framework##variableName; \ 337 static dispatch_once_t once; \ 338 dispatch_once(&once, ^{ \ 339 void* constant = dlsym(framework##Library(), #variableName); \ 340 ASSERT_WITH_MESSAGE(constant, "%s", dlerror()); \ 341 constant##framework##variableName = *static_cast<variableType*>(constant); \ 342 }); \ 343 return constant##framework##variableName; \ 307 344 } \ 308 345 } -
trunk/Source/WebCore/platform/win/SoftLinking.h
r180476 r180481 176 176 // See Source/WebCore/platform/cf/CoreMediaSoftLink.{cpp,h} for an example implementation. 177 177 178 #define SOFT_LINK_FRAMEWORK_HEADER(functionNamespace, framework) \ 179 namespace functionNamespace { \ 180 extern HMODULE framework##Library(bool isOptional = false); \ 181 bool is##framework##FrameworkAvailable(); \ 182 inline bool is##framework##FrameworkAvailable() { \ 183 return framework##Library(true) != nullptr; \ 184 } \ 185 } 186 187 #define SOFT_LINK_FRAMEWORK_HELPER(functionNamespace, framework, suffix) \ 188 namespace functionNamespace { \ 189 HMODULE framework##Library(bool isOptional = false); \ 190 HMODULE framework##Library(bool isOptional) \ 191 { \ 192 static HMODULE library = LoadLibraryW(L###framework suffix); \ 193 ASSERT_WITH_MESSAGE_UNUSED(isOptional, isOptional || library, "Could not load %s", L###framework suffix); \ 194 return library; \ 195 } \ 196 } 197 198 #define SOFT_LINK_FRAMEWORK(functionNamespace, framework) SOFT_LINK_FRAMEWORK_HELPER(functionNamespace, framework, L".dll") 199 #define SOFT_LINK_DEBUG_FRAMEWORK(functionNamespace, framework) SOFT_LINK_FRAMEWORK_HELPER(functionNamespace, framework, L"_debug.dll") 200 178 201 #ifdef DEBUG_ALL 179 #define SOFT_LINK_FRAMEWORK_SOURCE(functionNamespace, framework) \ 180 namespace functionNamespace { \ 181 SOFT_LINK_DEBUG_LIBRARY(framework) \ 182 } 202 #define SOFT_LINK_FRAMEWORK_SOURCE(functionNamespace, framework) SOFT_LINK_DEBUG_FRAMEWORK(functionNamespace, framework) 183 203 #else 184 #define SOFT_LINK_FRAMEWORK_SOURCE(functionNamespace, framework) \ 185 namespace functionNamespace { \ 186 SOFT_LINK_LIBRARY(framework) \ 187 } 204 #define SOFT_LINK_FRAMEWORK_SOURCE(functionNamespace, framework) SOFT_LINK_FRAMEWORK(functionNamespace, framework) 188 205 #endif 206 207 #define SOFT_LINK_CONSTANT_HEADER(functionNamespace, framework, variableName, variableType) \ 208 namespace functionNamespace { \ 209 const variableType get_##framework##_##variableName(); \ 210 } 211 212 #define SOFT_LINK_CONSTANT_SOURCE(functionNamespace, framework, variableName, variableType) \ 213 namespace functionNamespace { \ 214 static void init##framework##variableName(void* context) { \ 215 variableType* ptr = reinterpret_cast<variableType*>(SOFT_LINK_GETPROCADDRESS(framework##Library(), #variableName)); \ 216 ASSERT(ptr); \ 217 *static_cast<variableType*>(context) = *ptr; \ 218 } \ 219 const variableType get_##framework##_##variableName(); \ 220 const variableType get_##framework##_##variableName() \ 221 { \ 222 static variableType constant##framework##variableName; \ 223 static dispatch_once_t once; \ 224 dispatch_once_f(&once, static_cast<void*>(&constant##framework##variableName), init##framework##variableName); \ 225 return constant##framework##variableName; \ 226 } \ 227 } 189 228 190 229 #define SOFT_LINK_FUNCTION_HEADER(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
Note: See TracChangeset
for help on using the changeset viewer.