Reviewed by Darin Adler.
authorkdecker <kdecker@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2007 17:59:05 +0000 (17:59 +0000)
committerkdecker <kdecker@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Sep 2007 17:59:05 +0000 (17:59 +0000)
        <rdar://problem/5491066> soft link Accelerate.framework

        * Misc/WebGraphicsExtras.c:
        (WebConvertBGRAToARGB): Improve launch time performance and reduce vsize
        footprint by soft linking the Accelerate.framework.
        * WebKit.xcodeproj/project.pbxproj: Remove no longer needed frameworks.

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

WebKit/ChangeLog
WebKit/Misc/WebGraphicsExtras.c
WebKit/WebKit.xcodeproj/project.pbxproj

index 4f5401a83357be725f0dbdf08582d3f77e15c279..0955e7bd327fd12b8dc79711ac10364e18e98da8 100644 (file)
@@ -1,3 +1,14 @@
+2007-09-19  Kevin Decker  <kdecker@apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/5491066> soft link Accelerate.framework
+        
+        * Misc/WebGraphicsExtras.c:
+        (WebConvertBGRAToARGB): Improve launch time performance and reduce vsize
+        footprint by soft linking the Accelerate.framework.
+        * WebKit.xcodeproj/project.pbxproj: Remove no longer needed frameworks.
+
 2007-09-18  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Darin Adler.
index 1917901999c44666eea5351ca199fc69d29c3473..bbc36b05571273f4c326c89244f3e3b537809501 100644 (file)
 
 #import <Accelerate/Accelerate.h>
 #import <JavaScriptCore/Assertions.h>
+#import <dlfcn.h>
 
 unsigned WebConvertBGRAToARGB(unsigned char *offscreenBuffer, int rowBytes, int x, int y, int width, int height)
 {
+    
+    static vImage_Error (*softLink_vImagePermuteChannels_ARGB8888)(const vImage_Buffer *src, const vImage_Buffer *dest, const uint8_t permuteMap[4], vImage_Flags flags) = NULL;
+
+    if (!softLink_vImagePermuteChannels_ARGB8888) {
+        void *framework = dlopen("/System/Library/Frameworks/Accelerate.framework/Accelerate", RTLD_NOW);
+        ASSERT(framework);
+        softLink_vImagePermuteChannels_ARGB8888 = dlsym(framework, "vImagePermuteChannels_ARGB8888");
+        ASSERT(softLink_vImagePermuteChannels_ARGB8888);
+    }
+        
     void *swizzleImageBase = offscreenBuffer + y * rowBytes + x * 4;
     vImage_Buffer vImage = { swizzleImageBase, height, width, rowBytes };
     uint8_t vImagePermuteMap[4] = { 3, 2, 1, 0 }; // Where { 0, 1, 2, 3 } would leave the channels unchanged; this map converts BGRA to ARGB
-    vImage_Error vImageError = vImagePermuteChannels_ARGB8888(&vImage, &vImage, vImagePermuteMap, 0);
+    vImage_Error vImageError = softLink_vImagePermuteChannels_ARGB8888(&vImage, &vImage, vImagePermuteMap, 0);
     if (vImageError) {
         LOG_ERROR("Could not convert BGRA image to ARGB: %d", vImageError);
         return FALSE;
     }
+    
     return TRUE;
 }
index f41b2ecc04ddee0c0f371952d8df78748fe036de..50ab15511bbe1a0ca34f66826c6bd9f67c5ff167 100644 (file)
@@ -32,7 +32,6 @@
                225F881509F97E8A00423A40 /* WebPluginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 225F881409F97E8A00423A40 /* WebPluginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                226E9E6A09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 226E9E6809D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.h */; };
                226E9E6B09D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c in Sources */ = {isa = PBXBuildFile; fileRef = 226E9E6909D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c */; settings = {COMPILER_FLAGS = "-Wno-deprecated-declarations"; }; };
-               22C53C810A60E9C9003FC824 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22C53C800A60E9C9003FC824 /* Accelerate.framework */; };
                22E42A4F0A5B9F620003275B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22E42A4E0A5B9F620003275B /* OpenGL.framework */; };
                22E42A9A0A5BA4D00003275B /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22E42A990A5BA4D00003275B /* AGL.framework */; };
                22F219CC08D236730030E078 /* WebBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9398111E0824BF01008DF038 /* WebPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C3506C0321200A9B09E /* WebPDFView.mm */; };
                9398111F0824BF01008DF038 /* WebPDFRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E94C6906C0347500A9B09E /* WebPDFRepresentation.m */; };
                939811260824BF01008DF038 /* WebPluginContainerCheck.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65E1150407EFFEBF009B8BF7 /* WebPluginContainerCheck.mm */; };
-               939811280824BF01008DF038 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869302846DCD018635CA /* ApplicationServices.framework */; };
                939811290824BF01008DF038 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869402846DCD018635CA /* Carbon.framework */; };
                9398112A0824BF01008DF038 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5C2869502846DCD018635CA /* Cocoa.framework */; };
                9398112B0824BF01008DF038 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F738C9E903FAD3DF0321FBE0 /* JavaScriptCore.framework */; };
                225F881409F97E8A00423A40 /* WebPluginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginPrivate.h; sourceTree = "<group>"; };
                226E9E6809D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNetscapeDeprecatedFunctions.h; sourceTree = "<group>"; };
                226E9E6909D0AA8200F3A2BC /* WebNetscapeDeprecatedFunctions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WebNetscapeDeprecatedFunctions.c; sourceTree = "<group>"; };
-               22C53C800A60E9C9003FC824 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = "<absolute>"; };
                22E42A4E0A5B9F620003275B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
                22E42A990A5BA4D00003275B /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
                22F219CB08D236730030E078 /* WebBackForwardListPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F5B67130023EDF8901C1A525 /* url_icon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = url_icon.tiff; path = Resources/url_icon.tiff; sourceTree = "<group>"; };
                F5B92B820223191D01C1A525 /* WebHistoryPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F5C283730284676D018635CA /* WebKitPrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKitPrefix.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; };
-               F5C2869302846DCD018635CA /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
                F5C2869402846DCD018635CA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
                F5C2869502846DCD018635CA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
                F5E0A76E02B8FEE401C1A525 /* WebURLsWithTitles.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebURLsWithTitles.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               939811280824BF01008DF038 /* ApplicationServices.framework in Frameworks */,
                                939811290824BF01008DF038 /* Carbon.framework in Frameworks */,
                                9398112A0824BF01008DF038 /* Cocoa.framework in Frameworks */,
                                9398112B0824BF01008DF038 /* JavaScriptCore.framework in Frameworks */,
                                65A0006908527D1A005620FA /* libWebKitSystemInterface.a in Frameworks */,
                                22E42A4F0A5B9F620003275B /* OpenGL.framework in Frameworks */,
                                22E42A9A0A5BA4D00003275B /* AGL.framework in Frameworks */,
-                               22C53C810A60E9C9003FC824 /* Accelerate.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D69AFE84028FC02AAC07 /* Frameworks and Libraries */ = {
                        isa = PBXGroup;
                        children = (
-                               22C53C800A60E9C9003FC824 /* Accelerate.framework */,
                                22E42A990A5BA4D00003275B /* AGL.framework */,
-                               F5C2869302846DCD018635CA /* ApplicationServices.framework */,
                                F5C2869402846DCD018635CA /* Carbon.framework */,
                                F5C2869502846DCD018635CA /* Cocoa.framework */,
                                22E42A4E0A5B9F620003275B /* OpenGL.framework */,