Changeset 61625 in webkit
- Timestamp:
- Jun 22, 2010 12:54:41 PM (14 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r61592 r61625 1 2010-06-22 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Wean NetscapePluginHostManager of any knowledge about WebNetscapePluginPackage 6 https://bugs.webkit.org/show_bug.cgi?id=41006 7 8 * Plugins/Hosted/NetscapePluginHostManager.h: 9 * Plugins/Hosted/NetscapePluginHostManager.mm: 10 (WebKit::NetscapePluginHostManager::hostForPlugin): 11 (WebKit::NetscapePluginHostManager::spawnPluginHost): 12 (WebKit::NetscapePluginHostManager::instantiatePlugin): 13 (WebKit::NetscapePluginHostManager::createPropertyListFile): 14 * Plugins/Hosted/WebHostedNetscapePluginView.mm: 15 (-[WebHostedNetscapePluginView createPlugin]): 16 * Plugins/WebNetscapePluginPackage.mm: 17 (-[WebNetscapePluginPackage createPropertyListFile]): 18 1 19 2010-06-21 Anders Carlsson <andersca@apple.com> 2 20 -
trunk/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h
r52942 r61625 29 29 #define NetscapePluginHostManager_h 30 30 31 #import <WebCore/PlatformString.h> 32 #import <WebCore/StringHash.h> 31 33 #import <wtf/HashMap.h> 32 34 #import <wtf/PassRefPtr.h> 33 35 34 36 @class WebHostedNetscapePluginView; 35 @class WebNetscapePluginPackage;36 37 37 38 namespace WebKit { … … 44 45 static NetscapePluginHostManager& shared(); 45 46 46 PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin( WebNetscapePluginPackage *, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled);47 PassRefPtr<NetscapePluginInstanceProxy> instantiatePlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const WebCore::String& bundleIdentifier, WebHostedNetscapePluginView *, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled); 47 48 48 49 void pluginHostDied(NetscapePluginHostProxy*); 49 50 50 static void createPropertyListFile( WebNetscapePluginPackage *);51 static void createPropertyListFile(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture); 51 52 52 53 void didCreateWindow(); 53 54 54 55 private: 55 NetscapePluginHostProxy* hostForP ackage(WebNetscapePluginPackage *, bool useProxiedOpenPanel);56 NetscapePluginHostProxy* hostForPlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const WebCore::String& bundleIdentifier, bool useProxiedOpenPanel); 56 57 57 58 NetscapePluginHostManager(); 58 59 ~NetscapePluginHostManager(); 59 60 60 bool spawnPluginHost( WebNetscapePluginPackage *, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel);61 bool spawnPluginHost(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel); 61 62 62 63 bool initializeVendorPort(); … … 65 66 66 67 // FIXME: This should really be a HashMap of RetainPtrs, but that doesn't work right now. 67 typedef HashMap<Web NetscapePluginPackage*, NetscapePluginHostProxy*> PluginHostMap;68 typedef HashMap<WebCore::String, NetscapePluginHostProxy*> PluginHostMap; 68 69 PluginHostMap m_pluginHosts; 69 70 }; -
trunk/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
r61581 r61625 49 49 50 50 using namespace std; 51 using namespace WebCore; 51 52 52 53 namespace WebKit { … … 70 71 } 71 72 72 NetscapePluginHostProxy* NetscapePluginHostManager::hostForP ackage(WebNetscapePluginPackage *package, bool useProxiedOpenPanel)73 { 74 pair<PluginHostMap::iterator, bool> result = m_pluginHosts.add(p ackage, 0);73 NetscapePluginHostProxy* NetscapePluginHostManager::hostForPlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, bool useProxiedOpenPanel) 74 { 75 pair<PluginHostMap::iterator, bool> result = m_pluginHosts.add(pluginPath, 0); 75 76 76 77 // The package was already in the map, just return it. … … 86 87 mach_port_t pluginHostPort; 87 88 ProcessSerialNumber pluginHostPSN; 88 if (!spawnPluginHost(p ackage, clientPort, pluginHostPort, pluginHostPSN, useProxiedOpenPanel)) {89 if (!spawnPluginHost(pluginPath, pluginArchitecture, clientPort, pluginHostPort, pluginHostPSN, useProxiedOpenPanel)) { 89 90 mach_port_destroy(mach_task_self(), clientPort); 90 91 m_pluginHosts.remove(result.first); … … 94 95 // Since Flash NPObjects add methods dynamically, we don't want to cache when a property/method doesn't exist 95 96 // on an object because it could be added later. 96 bool shouldCacheMissingPropertiesAndMethods = [package bundleIdentifier]!= "com.macromedia.Flash Player.plugin";97 bool shouldCacheMissingPropertiesAndMethods = bundleIdentifier != "com.macromedia.Flash Player.plugin"; 97 98 98 99 NetscapePluginHostProxy* hostProxy = new NetscapePluginHostProxy(clientPort, pluginHostPort, pluginHostPSN, shouldCacheMissingPropertiesAndMethods); 99 100 100 CFRetain(package);101 101 result.first->second = hostProxy; 102 102 … … 104 104 } 105 105 106 bool NetscapePluginHostManager::spawnPluginHost( WebNetscapePluginPackage *package, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel)106 bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel) 107 107 { 108 108 if (m_pluginVendorPort == MACH_PORT_NULL) { … … 122 122 NSDictionary *launchProperties = [[NSDictionary alloc] initWithObjectsAndKeys: 123 123 pluginHostAppExecutablePath, @"pluginHostPath", 124 [NSNumber numberWithInt: [package pluginHostArchitecture]], @"cpuType",124 [NSNumber numberWithInt:pluginArchitecture], @"cpuType", 125 125 localization.get(), @"localization", 126 126 [NSNumber numberWithBool:useProxiedOpenPanel], @"useProxiedOpenPanel", … … 153 153 "visible name of the plug-in host process. The first argument is the plug-in name " 154 154 "and the second argument is the application name."), 155 [ (NSString *)[package pluginInfo].filestringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]];155 [[(NSString*)pluginPath lastPathComponent] stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]]; 156 156 157 157 NSDictionary *hostProperties = [[NSDictionary alloc] initWithObjectsAndKeys: 158 158 visibleName, @"visibleName", 159 (NSString *) [package path], @"bundlePath",159 (NSString *)pluginPath, @"bundlePath", 160 160 nil]; 161 161 … … 216 216 } 217 217 218 PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin( WebNetscapePluginPackage *pluginPackage, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled)218 PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePlugin(const String& pluginPath, cpu_type_t pluginArchitecture, const String& bundleIdentifier, WebHostedNetscapePluginView *pluginView, NSString *mimeType, NSArray *attributeKeys, NSArray *attributeValues, NSString *userAgent, NSURL *sourceURL, bool fullFrame, bool isPrivateBrowsingEnabled, bool isAcceleratedCompositingEnabled) 219 219 { 220 220 WebPreferences *preferences = [[pluginView webView] preferences]; 221 NetscapePluginHostProxy* hostProxy = hostForP ackage(pluginPackage, [preferences usesProxiedOpenPanel]);221 NetscapePluginHostProxy* hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier, [preferences usesProxiedOpenPanel]); 222 222 if (!hostProxy) 223 223 return 0; … … 258 258 259 259 // Try to spawn it again. 260 hostProxy = hostForP ackage(pluginPackage, [preferences usesProxiedOpenPanel]);260 hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier, [preferences usesProxiedOpenPanel]); 261 261 262 262 // Create a new instance. … … 278 278 } 279 279 280 void NetscapePluginHostManager::createPropertyListFile( WebNetscapePluginPackage *package)280 void NetscapePluginHostManager::createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture) 281 281 { 282 282 NSString *pluginHostAppPath = [[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] pathForAuxiliaryExecutable:pluginHostAppName]; 283 283 NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath]; 284 NSString *bundlePath = [package path];284 NSString *bundlePath = pluginPath; 285 285 286 286 pid_t pid; … … 290 290 // Set the architecture. 291 291 size_t ocount = 0; 292 int cpuTypes[ 1] = { [package pluginHostArchitecture]};292 int cpuTypes[] = { pluginArchitecture }; 293 293 posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &ocount); 294 294 -
trunk/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
r59865 r61625 112 112 #endif 113 113 114 _proxy = NetscapePluginHostManager::shared().instantiatePlugin( _pluginPackage.get(), self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(),114 _proxy = NetscapePluginHostManager::shared().instantiatePlugin([_pluginPackage.get() path], [_pluginPackage.get() pluginHostArchitecture], [_pluginPackage.get() bundleIdentifier], self, _MIMEType.get(), _attributeKeys.get(), _attributeValues.get(), userAgent, _sourceURL.get(), 115 115 _mode == NP_FULL, _isPrivateBrowsingEnabled, accleratedCompositingEnabled); 116 116 if (!_proxy) -
trunk/WebKit/mac/Plugins/WebNetscapePluginPackage.mm
r61592 r61625 303 303 - (void)createPropertyListFile 304 304 { 305 NetscapePluginHostManager::createPropertyListFile( self);305 NetscapePluginHostManager::createPropertyListFile(path, pluginHostArchitecture); 306 306 } 307 307
Note: See TracChangeset
for help on using the changeset viewer.