Changeset 61519 in webkit
- Timestamp:
- Jun 20, 2010 6:30:14 PM (14 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r61510 r61519 1 2010-06-20 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 Move the NSBundle ivar to WebPluginPackage 6 https://bugs.webkit.org/show_bug.cgi?id=40894 7 8 * Plugins/WebBasePluginPackage.h: 9 * Plugins/WebBasePluginPackage.mm: 10 (-[WebBasePluginPackage initWithPath:]): 11 (-[WebBasePluginPackage _objectForInfoDictionaryKey:]): 12 (-[WebBasePluginPackage getPluginInfoFromPLists]): 13 (-[WebBasePluginPackage load]): 14 (-[WebBasePluginPackage dealloc]): 15 * Plugins/WebNetscapePluginPackage.mm: 16 (-[WebNetscapePluginPackage _initWithPath:]): 17 * Plugins/WebPluginPackage.h: 18 * Plugins/WebPluginPackage.mm: 19 (-[WebPluginPackage initWithPath:]): 20 (-[WebPluginPackage dealloc]): 21 (-[WebPluginPackage viewFactory]): 22 (-[WebPluginPackage load]): 23 1 24 2010-06-20 Anders Carlsson <andersca@apple.com> 2 25 -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.h
r61510 r61519 61 61 WebCore::String pluginDescription; 62 62 63 NSBundle *bundle;64 63 CFBundleRef cfBundle; 65 64 -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.mm
r61510 r61519 125 125 126 126 path = pathByResolvingSymlinksAndAliases(pluginPath); 127 bundle = [[NSBundle alloc] initWithPath:path]; 127 cfBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:path]); 128 128 129 #ifndef __ppc__ 129 130 // 32-bit PowerPC is the only platform where non-bundled CFM plugins are supported 130 if (! bundle) {131 if (!cfBundle) { 131 132 [self release]; 132 133 return nil; 133 134 } 134 135 #endif 135 cfBundle = CFBundleCreate(NULL, (CFURLRef)[NSURL fileURLWithPath:path]);136 136 extensionToMIME = [[NSMutableDictionary alloc] init]; 137 137 … … 168 168 } 169 169 170 - (id)_objectForInfoDictionaryKey:(NSString *)key 171 { 172 CFDictionaryRef bundleInfoDictionary = CFBundleGetInfoDictionary(cfBundle); 173 if (!bundleInfoDictionary) 174 return nil; 175 176 return (id)CFDictionaryGetValue(bundleInfoDictionary, key); 177 } 178 170 179 - (BOOL)getPluginInfoFromPLists 171 180 { 172 if (! bundle)181 if (!cfBundle) 173 182 return NO; 174 183 175 184 NSDictionary *MIMETypes = nil; 176 NSString *pListFilename = [ bundleobjectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey];185 NSString *pListFilename = [self _objectForInfoDictionaryKey:WebPluginMIMETypesFilenameKey]; 177 186 178 187 // Check if the MIME types are claimed in a plist in the user's preferences directory. … … 192 201 193 202 if (!MIMETypes) { 194 MIMETypes = [ bundleobjectForInfoDictionaryKey:WebPluginMIMETypesKey];203 MIMETypes = [self _objectForInfoDictionaryKey:WebPluginMIMETypesKey]; 195 204 if (!MIMETypes) 196 205 return NO; … … 232 241 NSString *filename = [self filename]; 233 242 234 NSString *theName = [ bundleobjectForInfoDictionaryKey:WebPluginNameKey];243 NSString *theName = [self _objectForInfoDictionaryKey:WebPluginNameKey]; 235 244 if (!theName) 236 245 theName = filename; 237 246 name = theName; 238 247 239 description = [ bundleobjectForInfoDictionaryKey:WebPluginDescriptionKey];248 description = [self _objectForInfoDictionaryKey:WebPluginDescriptionKey]; 240 249 if (!description) 241 250 description = filename; … … 247 256 - (BOOL)load 248 257 { 249 if ( bundle && !BP_CreatePluginMIMETypesPreferences)258 if (cfBundle && !BP_CreatePluginMIMETypesPreferences) 250 259 BP_CreatePluginMIMETypesPreferences = (BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(cfBundle, CFSTR("BP_CreatePluginMIMETypesPreferences")); 251 260 … … 262 271 [extensionToMIME release]; 263 272 264 [bundle release];265 273 if (cfBundle) 266 274 CFRelease(cfBundle); … … 329 337 { 330 338 return [MIMEToExtensions objectForKey:MIMEType]; 331 }332 333 - (NSBundle *)bundle334 {335 return bundle;336 339 } 337 340 -
trunk/WebKit/mac/Plugins/WebNetscapePluginPackage.mm
r61510 r61519 36 36 #import "WebNetscapeDeprecatedFunctions.h" 37 37 #import <WebCore/npruntime_impl.h> 38 #import <wtf/RetainPtr.h> 38 39 39 40 #if USE(PLUGIN_HOST_PROCESS) … … 209 210 OSType type = 0; 210 211 211 if ( bundle) {212 if (cfBundle) { 212 213 // Bundle 213 214 CFBundleGetPackageInfo(cfBundle, &type, NULL); … … 231 232 232 233 // Check if the executable is Mach-O or CFM. 233 if (bundle) { 234 NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[bundle executablePath]]; 234 if (cfBundle) { 235 RetainPtr<CFURLRef> executableURL(AdoptCF, CFBundleCopyExecutableURL(cfBundle)); 236 if (!executableURL) 237 return NO; 238 NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[(NSURL *)executableURL.get() path]]; 235 239 NSData *data = [executableFile readDataOfLength:512]; 236 240 [executableFile closeFile]; … … 247 251 248 252 #if USE(PLUGIN_HOST_PROCESS) 249 NSArray *archs = [bundle executableArchitectures];250 251 if ([ archscontainsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]])253 RetainPtr<CFArrayRef> archs(AdoptCF, CFBundleCopyExecutableArchitectures(cfBundle)); 254 255 if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]]) 252 256 pluginHostArchitecture = CPU_TYPE_X86_64; 253 else if ([ archscontainsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureI386]])257 else if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureI386]]) 254 258 pluginHostArchitecture = CPU_TYPE_X86; 255 259 else -
trunk/WebKit/mac/Plugins/WebPluginPackage.h
r11962 r61519 33 33 @protocol WebPluginViewFactory; 34 34 35 @interface WebPluginPackage : WebBasePluginPackage 35 @interface WebPluginPackage : WebBasePluginPackage { 36 NSBundle *nsBundle; 37 } 36 38 37 39 - (Class)viewFactory; -
trunk/WebKit/mac/Plugins/WebPluginPackage.mm
r61509 r61519 41 41 @implementation WebPluginPackage 42 42 43 - initWithPath:(NSString *)pluginPath43 - (id)initWithPath:(NSString *)pluginPath 44 44 { 45 45 if (!(self = [super initWithPath:pluginPath])) 46 46 return nil; 47 47 48 if (bundle == nil) { 48 nsBundle = [[NSBundle alloc] initWithPath:path]; 49 50 if (!nsBundle) { 49 51 [self release]; 50 52 return nil; … … 60 62 } 61 63 62 NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[ bundle executablePath]];64 NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[nsBundle executablePath]]; 63 65 NSData *data = [executableFile readDataOfLength:512]; 64 66 [executableFile closeFile]; … … 76 78 } 77 79 80 - (void)dealloc 81 { 82 [nsBundle release]; 83 84 [super dealloc]; 85 } 86 78 87 - (Class)viewFactory 79 88 { 80 return [ bundle principalClass];89 return [nsBundle principalClass]; 81 90 } 82 91 … … 88 97 89 98 // Load the bundle 90 if (![ bundle isLoaded]) {91 if (![ bundle load])99 if (![nsBundle isLoaded]) { 100 if (![nsBundle load]) 92 101 return NO; 93 102 }
Note: See TracChangeset
for help on using the changeset viewer.