Changeset 61625 in webkit


Ignore:
Timestamp:
Jun 22, 2010 12:54:41 PM (14 years ago)
Author:
andersca@apple.com
Message:

2010-06-22 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Wean NetscapePluginHostManager of any knowledge about WebNetscapePluginPackage
https://bugs.webkit.org/show_bug.cgi?id=41006

  • Plugins/Hosted/NetscapePluginHostManager.h:
  • Plugins/Hosted/NetscapePluginHostManager.mm: (WebKit::NetscapePluginHostManager::hostForPlugin): (WebKit::NetscapePluginHostManager::spawnPluginHost): (WebKit::NetscapePluginHostManager::instantiatePlugin): (WebKit::NetscapePluginHostManager::createPropertyListFile):
  • Plugins/Hosted/WebHostedNetscapePluginView.mm: (-[WebHostedNetscapePluginView createPlugin]):
  • Plugins/WebNetscapePluginPackage.mm: (-[WebNetscapePluginPackage createPropertyListFile]):
Location:
trunk/WebKit/mac
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/mac/ChangeLog

    r61592 r61625  
     12010-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
    1192010-06-21  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h

    r52942 r61625  
    2929#define NetscapePluginHostManager_h
    3030
     31#import <WebCore/PlatformString.h>
     32#import <WebCore/StringHash.h>
    3133#import <wtf/HashMap.h>
    3234#import <wtf/PassRefPtr.h>
    3335
    3436@class WebHostedNetscapePluginView;
    35 @class WebNetscapePluginPackage;
    3637
    3738namespace WebKit {
     
    4445    static NetscapePluginHostManager& shared();
    4546   
    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);
    4748
    4849    void pluginHostDied(NetscapePluginHostProxy*);
    4950
    50     static void createPropertyListFile(WebNetscapePluginPackage *);
     51    static void createPropertyListFile(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture);
    5152   
    5253    void didCreateWindow();
    5354   
    5455private:
    55     NetscapePluginHostProxy* hostForPackage(WebNetscapePluginPackage *, bool useProxiedOpenPanel);
     56    NetscapePluginHostProxy* hostForPlugin(const WebCore::String& pluginPath, cpu_type_t pluginArchitecture, const WebCore::String& bundleIdentifier, bool useProxiedOpenPanel);
    5657
    5758    NetscapePluginHostManager();
    5859    ~NetscapePluginHostManager();
    5960   
    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);
    6162   
    6263    bool initializeVendorPort();
     
    6566   
    6667    // FIXME: This should really be a HashMap of RetainPtrs, but that doesn't work right now.
    67     typedef HashMap<WebNetscapePluginPackage*, NetscapePluginHostProxy*> PluginHostMap;
     68    typedef HashMap<WebCore::String, NetscapePluginHostProxy*> PluginHostMap;
    6869    PluginHostMap m_pluginHosts;
    6970};
  • trunk/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm

    r61581 r61625  
    4949
    5050using namespace std;
     51using namespace WebCore;
    5152
    5253namespace WebKit {
     
    7071}
    7172
    72 NetscapePluginHostProxy* NetscapePluginHostManager::hostForPackage(WebNetscapePluginPackage *package, bool useProxiedOpenPanel)
    73 {
    74     pair<PluginHostMap::iterator, bool> result = m_pluginHosts.add(package, 0);
     73NetscapePluginHostProxy* 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);
    7576   
    7677    // The package was already in the map, just return it.
     
    8687    mach_port_t pluginHostPort;
    8788    ProcessSerialNumber pluginHostPSN;
    88     if (!spawnPluginHost(package, clientPort, pluginHostPort, pluginHostPSN, useProxiedOpenPanel)) {
     89    if (!spawnPluginHost(pluginPath, pluginArchitecture, clientPort, pluginHostPort, pluginHostPSN, useProxiedOpenPanel)) {
    8990        mach_port_destroy(mach_task_self(), clientPort);
    9091        m_pluginHosts.remove(result.first);
     
    9495    // Since Flash NPObjects add methods dynamically, we don't want to cache when a property/method doesn't exist
    9596    // 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";
    9798   
    9899    NetscapePluginHostProxy* hostProxy = new NetscapePluginHostProxy(clientPort, pluginHostPort, pluginHostPSN, shouldCacheMissingPropertiesAndMethods);
    99100   
    100     CFRetain(package);
    101101    result.first->second = hostProxy;
    102102   
     
    104104}
    105105
    106 bool NetscapePluginHostManager::spawnPluginHost(WebNetscapePluginPackage *package, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel)
     106bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_type_t pluginArchitecture, mach_port_t clientPort, mach_port_t& pluginHostPort, ProcessSerialNumber& pluginHostPSN, bool useProxiedOpenPanel)
    107107{
    108108    if (m_pluginVendorPort == MACH_PORT_NULL) {
     
    122122    NSDictionary *launchProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
    123123                                      pluginHostAppExecutablePath, @"pluginHostPath",
    124                                       [NSNumber numberWithInt:[package pluginHostArchitecture]], @"cpuType",
     124                                      [NSNumber numberWithInt:pluginArchitecture], @"cpuType",
    125125                                      localization.get(), @"localization",
    126126                                      [NSNumber numberWithBool:useProxiedOpenPanel], @"useProxiedOpenPanel",
     
    153153                                                                 "visible name of the plug-in host process. The first argument is the plug-in name "
    154154                                                                 "and the second argument is the application name."),
    155                              [(NSString *)[package pluginInfo].file stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]];
     155                             [[(NSString*)pluginPath lastPathComponent] stringByDeletingPathExtension], [[NSProcessInfo processInfo] processName]];
    156156   
    157157    NSDictionary *hostProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
    158158                                    visibleName, @"visibleName",
    159                                     (NSString *)[package path], @"bundlePath",
     159                                    (NSString *)pluginPath, @"bundlePath",
    160160                                    nil];
    161161   
     
    216216}
    217217
    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)
     218PassRefPtr<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)
    219219{
    220220    WebPreferences *preferences = [[pluginView webView] preferences];
    221     NetscapePluginHostProxy* hostProxy = hostForPackage(pluginPackage, [preferences usesProxiedOpenPanel]);
     221    NetscapePluginHostProxy* hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier, [preferences usesProxiedOpenPanel]);
    222222    if (!hostProxy)
    223223        return 0;
     
    258258
    259259        // Try to spawn it again.
    260         hostProxy = hostForPackage(pluginPackage, [preferences usesProxiedOpenPanel]);
     260        hostProxy = hostForPlugin(pluginPath, pluginArchitecture, bundleIdentifier, [preferences usesProxiedOpenPanel]);
    261261       
    262262        // Create a new instance.
     
    278278}
    279279
    280 void NetscapePluginHostManager::createPropertyListFile(WebNetscapePluginPackage *package)
     280void NetscapePluginHostManager::createPropertyListFile(const String& pluginPath, cpu_type_t pluginArchitecture)
    281281{   
    282282    NSString *pluginHostAppPath = [[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] pathForAuxiliaryExecutable:pluginHostAppName];
    283283    NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath];
    284     NSString *bundlePath = [package path];
     284    NSString *bundlePath = pluginPath;
    285285
    286286    pid_t pid;
     
    290290    // Set the architecture.
    291291    size_t ocount = 0;
    292     int cpuTypes[1] = { [package pluginHostArchitecture] };
     292    int cpuTypes[] = { pluginArchitecture };
    293293    posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &ocount);
    294294   
  • trunk/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm

    r59865 r61625  
    112112#endif
    113113   
    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(),
    115115                                                                   _mode == NP_FULL, _isPrivateBrowsingEnabled, accleratedCompositingEnabled);
    116116    if (!_proxy)
  • trunk/WebKit/mac/Plugins/WebNetscapePluginPackage.mm

    r61592 r61625  
    303303- (void)createPropertyListFile
    304304{
    305     NetscapePluginHostManager::createPropertyListFile(self);
     305    NetscapePluginHostManager::createPropertyListFile(path, pluginHostArchitecture);
    306306}
    307307
Note: See TracChangeset for help on using the changeset viewer.