[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:31:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4b5ab4a587bb209c0c1cdb35e272f7654695c067
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 26 19:04:40 2003 +0000

    	Use the private _cfBundle method on NSBundle so we only create 1 bundle per plug-in package class.
    
            Reviewed by trey.
    
            * Plugins.subproj/WebBasePluginPackage.h:
            * Plugins.subproj/WebBasePluginPackage.m:
            (-[WebBasePluginPackage initWithPath:]):
            (-[WebBasePluginPackage getPluginInfoFromBundleAndMIMEDictionary:]):
            (-[WebBasePluginPackage dealloc]):
            * Plugins.subproj/WebNetscapePluginPackage.h:
            * Plugins.subproj/WebNetscapePluginPackage.m:
            (-[WebNetscapePluginPackage openResourceFile]):
            (-[WebNetscapePluginPackage closeResourceFile:]):
            (-[WebNetscapePluginPackage getPluginInfoFromPLists]):
            (-[WebNetscapePluginPackage initWithPath:]):
            (-[WebNetscapePluginPackage load]):
            (-[WebNetscapePluginPackage unload]):
            * Plugins.subproj/WebPluginPackage.m:
            (-[WebPluginPackage initWithPath:]):
            (-[WebPluginPackage viewFactory]):
            (-[WebPluginPackage load]):
            (-[WebPluginPackage isLoaded]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3924 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7e9efe2..0d4f00c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,28 @@
+2003-03-26  Chris Blumenberg  <cblu at apple.com>
+
+	Use the private _cfBundle method on NSBundle so we only create 1 bundle per plug-in package class.
+
+        Reviewed by trey.
+
+        * Plugins.subproj/WebBasePluginPackage.h:
+        * Plugins.subproj/WebBasePluginPackage.m:
+        (-[WebBasePluginPackage initWithPath:]):
+        (-[WebBasePluginPackage getPluginInfoFromBundleAndMIMEDictionary:]):
+        (-[WebBasePluginPackage dealloc]):
+        * Plugins.subproj/WebNetscapePluginPackage.h:
+        * Plugins.subproj/WebNetscapePluginPackage.m:
+        (-[WebNetscapePluginPackage openResourceFile]):
+        (-[WebNetscapePluginPackage closeResourceFile:]):
+        (-[WebNetscapePluginPackage getPluginInfoFromPLists]):
+        (-[WebNetscapePluginPackage initWithPath:]):
+        (-[WebNetscapePluginPackage load]):
+        (-[WebNetscapePluginPackage unload]):
+        * Plugins.subproj/WebPluginPackage.m:
+        (-[WebPluginPackage initWithPath:]):
+        (-[WebPluginPackage viewFactory]):
+        (-[WebPluginPackage load]):
+        (-[WebPluginPackage isLoaded]):
+
 2003-03-26  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by Maciej
diff --git a/WebKit/Plugins.subproj/WebBasePluginPackage.h b/WebKit/Plugins.subproj/WebBasePluginPackage.h
index c6403f4..40558a0 100644
--- a/WebKit/Plugins.subproj/WebBasePluginPackage.h
+++ b/WebKit/Plugins.subproj/WebBasePluginPackage.h
@@ -25,7 +25,7 @@
     NSString *path;
     NSString *pluginDescription;
 
-    NSBundle *nsBundle;
+    NSBundle *bundle;
 
     NSDictionary *MIMEToDescription;
     NSDictionary *MIMEToExtensions;
diff --git a/WebKit/Plugins.subproj/WebBasePluginPackage.m b/WebKit/Plugins.subproj/WebBasePluginPackage.m
index 6dff937..895ef12 100644
--- a/WebKit/Plugins.subproj/WebBasePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebBasePluginPackage.m
@@ -58,18 +58,18 @@
     [super init];
     extensionToMIME = [[NSMutableDictionary dictionary] retain];
     path = [[self pathByResolvingSymlinksAndAliasesInPath:pluginPath] retain];
-    nsBundle = [[NSBundle alloc] initWithPath:path];
+    bundle = [[NSBundle alloc] initWithPath:path];
     return self;
 }
 
 - (BOOL)getPluginInfoFromBundleAndMIMEDictionary:(NSDictionary *)MIMETypes
 {
-    if (!nsBundle) {
+    if (!bundle) {
         return NO;
     }
     
     if (!MIMETypes) {
-        MIMETypes = [nsBundle objectForInfoDictionaryKey:WebPluginMIMETypesKey];
+        MIMETypes = [bundle objectForInfoDictionaryKey:WebPluginMIMETypesKey];
         if (!MIMETypes) {
             return NO;
         }
@@ -111,13 +111,13 @@
 
     NSString *filename = [self filename];
 
-    NSString *theName = [nsBundle objectForInfoDictionaryKey:WebPluginNameKey];
+    NSString *theName = [bundle objectForInfoDictionaryKey:WebPluginNameKey];
     if (!theName) {
         theName = filename;
     }
     [self setName:theName];
 
-    description = [nsBundle objectForInfoDictionaryKey:WebPluginDescriptionKey];
+    description = [bundle objectForInfoDictionaryKey:WebPluginDescriptionKey];
     if (!description) {
         description = filename;
     }
@@ -150,7 +150,7 @@
     [MIMEToExtensions release];
     [extensionToMIME release];
 
-    [nsBundle release];
+    [bundle release];
     
     [super dealloc];
 }
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.h b/WebKit/Plugins.subproj/WebNetscapePluginPackage.h
index bfb8042..f81b6ce 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.h
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.h
@@ -26,9 +26,7 @@ typedef enum {
     
     uint16 pluginSize;
     uint16 pluginVersion;
-    
-    CFBundleRef cfBundle;
-    
+        
     CFragConnectionID connID;
     
     SInt16 resourceRef;
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
index c5ac9f1..4f453aa 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
@@ -9,6 +9,8 @@
 
 #import <CoreFoundation/CFBundlePriv.h>
 
+#import <Foundation/NSBundle_Private.h>
+
 typedef void (* FunctionPointer) (void);
 typedef void (* TransitionVector) (void);
 static FunctionPointer functionPointerForTVector(TransitionVector);
@@ -50,7 +52,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     OSErr err;
     
     if (isBundle) {
-        return CFBundleOpenBundleResourceMap(cfBundle);
+        return CFBundleOpenBundleResourceMap([bundle _cfBundle]);
     } else {
         err = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &fref, NULL);
         if (err != noErr) {
@@ -64,7 +66,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 - (void)closeResourceFile:(SInt16)resRef
 {
     if (isBundle) {
-        CFBundleCloseBundleResourceMap(cfBundle, resRef);
+        CFBundleCloseBundleResourceMap([bundle _cfBundle], resRef);
     } else {
         CloseResFile(resRef);
     }
@@ -191,12 +193,12 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 
 - (BOOL)getPluginInfoFromPLists
 {
-    if (!nsBundle) {
+    if (!bundle) {
         return NO;
     }
 
     NSDictionary *MIMETypes = nil;
-    NSString *pListFilename = [nsBundle objectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey];
+    NSString *pListFilename = [bundle objectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey];
 
     // Check if the MIME types are claimed in a plist in the user's preferences directory.
     if (pListFilename) {
@@ -223,23 +225,19 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
 {
     [super initWithPath:pluginPath];
     
-    NSDictionary *fileInfo = [[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES];
     OSType type = 0;
 
     // Bundle
-    if ([[fileInfo objectForKey:NSFileType] isEqualToString:NSFileTypeDirectory]) {
-        cfBundle = CFBundleCreate(NULL, (CFURLRef)[NSURL fileURLWithPath:path]);
-        if (cfBundle) {
-            isBundle = YES;
-            CFBundleGetPackageInfo(cfBundle, &type, NULL);
-        }
+    if (bundle) {
+        isBundle = YES;
+        CFBundleGetPackageInfo([bundle _cfBundle], &type, NULL);
     }
-    
 #ifdef __ppc__
     // Single-file plug-in with resource fork
-    if ([[fileInfo objectForKey:NSFileType] isEqualToString:NSFileTypeRegular]) {
-        type = [fileInfo fileHFSTypeCode];
+    else {
+        type = [[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES] fileHFSTypeCode];
         isBundle = NO;
+        isCFM = YES;
     }
 #endif
     
@@ -249,8 +247,8 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     }
 
     // Check if the executable is Mach-O or CFM.
-    if (cfBundle) {
-        NSURL *executableURL = (NSURL *)CFBundleCopyExecutableURL(cfBundle);
+    if (bundle) {
+        NSURL *executableURL = (NSURL *)CFBundleCopyExecutableURL([bundle _cfBundle]);
         NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[executableURL path]];
         [executableURL release];
         NSData *data = [executableFile readDataOfLength:8];
@@ -307,6 +305,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     }
     
     if (isBundle) {
+        CFBundleRef cfBundle = [bundle _cfBundle];
         if (!CFBundleLoadExecutable(cfBundle)) {
             return NO;
         }
@@ -323,7 +322,8 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
             }
         }
         BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("BP_CreatePluginMIMETypesPreferences"));
-    } else { // single CFM file
+    } else {
+        // single CFM file
         FSSpec spec;
         FSRef fref;
         
@@ -461,9 +461,7 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     [self closeResourceFile:resourceRef];
     
     if (isBundle) {
-        CFBundleUnloadExecutable(cfBundle);
-        CFRelease(cfBundle);
-        cfBundle = NULL;
+        CFBundleUnloadExecutable([bundle _cfBundle]);
     } else {
         CloseConnection(&connID);
     }
@@ -471,14 +469,6 @@ static TransitionVector tVectorForFunctionPointer(FunctionPointer);
     isLoaded = FALSE;
 }
 
-- (void)dealloc
-{
-    if (cfBundle) {
-        CFRelease(cfBundle);
-    }
-    [super dealloc];
-}
-
 - (NPP_SetWindowProcPtr)NPP_SetWindow
 {
     return NPP_SetWindow;
diff --git a/WebKit/Plugins.subproj/WebPluginPackage.m b/WebKit/Plugins.subproj/WebPluginPackage.m
index a67eaba..6a0eb98 100644
--- a/WebKit/Plugins.subproj/WebPluginPackage.m
+++ b/WebKit/Plugins.subproj/WebPluginPackage.m
@@ -8,23 +8,21 @@
 
 #import <WebKit/WebPluginPackage.h>
 
+#import <Foundation/NSBundle_Private.h>
+
 @implementation WebPluginPackage
 
 - initWithPath:(NSString *)pluginPath
 {
     [super initWithPath:pluginPath];
 
-    if (!nsBundle) {
+    if (!bundle) {
         [self release];
         return nil;
     }
     
     UInt32 type = 0;
-    CFBundleRef cfBundle = CFBundleCreate(NULL, (CFURLRef)[NSURL fileURLWithPath:path]);        
-    if (cfBundle) {
-        CFBundleGetPackageInfo(cfBundle, &type, NULL);
-        CFRelease(cfBundle);
-    }
+    CFBundleGetPackageInfo([bundle _cfBundle], &type, NULL);
     
     if (type != FOUR_CHAR_CODE('WBPL')) {
         [self release];
@@ -41,12 +39,12 @@
 
 - (Class)viewFactory
 {
-    return [nsBundle principalClass];
+    return [bundle principalClass];
 }
 
 - (BOOL)load
 {
-    [nsBundle principalClass];
+    [bundle principalClass];
     return YES;
 }
 
@@ -56,7 +54,7 @@
 
 - (BOOL)isLoaded
 {
-    return [nsBundle isLoaded];
+    return [bundle isLoaded];
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list