Part of WebCore should use CFNetwork-based loader on Mac
authorpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Apr 2011 18:52:09 +0000 (18:52 +0000)
committerpsolanki@apple.com <psolanki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Apr 2011 18:52:09 +0000 (18:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=51836

Reviewed by Antti Koivisto.

* Configurations/WebCore.xcconfig: Add location of CFNetwork.framework.
* platform/mac/SoftLinking.h:
* platform/network/cf/CookieJarCFNet.cpp: Soft-link in CFNetwork functions on Mac.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85070 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/platform/mac/SoftLinking.h
Source/WebCore/platform/network/cf/CookieJarCFNet.cpp

index 9766549..4a2f3e2 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-27  Pratik Solanki  <psolanki@apple.com>
+
+        Reviewed by Antti Koivisto.
+
+        Part of WebCore should use CFNetwork-based loader on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=51836
+
+        * Configurations/WebCore.xcconfig: Add location of CFNetwork.framework.
+        * platform/mac/SoftLinking.h:
+        * platform/network/cf/CookieJarCFNet.cpp: Soft-link in CFNetwork functions on Mac.
+
 2011-04-27  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Reviewed by Antti Koivisto.
index 2421992..3ba7319 100644 (file)
@@ -41,7 +41,7 @@ FRAMEWORK_SEARCH_PATHS_iphoneos_Debug = $(BUILT_PRODUCTS_DIR) $(PRODUCTION_FRAME
 FRAMEWORK_SEARCH_PATHS_iphoneos_Release = $(FRAMEWORK_SEARCH_PATHS_iphoneos_Debug);
 FRAMEWORK_SEARCH_PATHS_iphoneos_Production = $(PRODUCTION_FRAMEWORKS_DIR);
 FRAMEWORK_SEARCH_PATHS_iphonesimulator = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION));
-FRAMEWORK_SEARCH_PATHS_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS);
+FRAMEWORK_SEARCH_PATHS_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS);
 
 HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 $(SQLITE3_HEADER_SEARCH_PATHS) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" "${BUILT_PRODUCTS_DIR}/usr/local/include" $(HEADER_SEARCH_PATHS);
 INFOPLIST_FILE = Info.plist;
index ce72f34..885b27e 100644 (file)
         return frameworkLibrary; \
     }
 
+#define SOFT_LINK_FRAMEWORK_IN_CORESERVICES_UMBRELLA(framework) \
+    static void* framework##Library() \
+    { \
+        static void* frameworkLibrary = dlopen("/System/Library/Frameworks/CoreServices.framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+        ASSERT(frameworkLibrary); \
+        return frameworkLibrary; \
+    }
+
 #define SOFT_LINK(framework, functionName, resultType, parameterDeclarations, parameterNames) \
     static resultType init##functionName parameterDeclarations; \
     static resultType (*softLink##functionName) parameterDeclarations = init##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) \
+    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) \
     static Class init##className(); \
     static Class (*get##className##Class)() = init##className; \
index 71c5e25..358c72d 100644 (file)
 #include "SoftLinking.h"
 #include <CFNetwork/CFHTTPCookiesPriv.h>
 #include <CoreFoundation/CoreFoundation.h>
+
+#if PLATFORM(WIN)
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <windows.h>
+#endif
 
 namespace WebCore {
 
 static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie");
 static const CFStringRef s_cookieCF = CFSTR("Cookie");
 
+#if PLATFORM(WIN)
 #ifdef DEBUG_ALL
 SOFT_LINK_DEBUG_LIBRARY(CFNetwork)
 #else
 SOFT_LINK_LIBRARY(CFNetwork)
 #endif
+#else
+SOFT_LINK_FRAMEWORK_IN_CORESERVICES_UMBRELLA(CFNetwork)
+#endif
 
 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyDomain, CFStringRef, __cdecl, (CFHTTPCookieRef))
 SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieGetExpirationTime, CFAbsoluteTime, __cdecl, (CFHTTPCookieRef))