Changeset 85978 in webkit


Ignore:
Timestamp:
May 6, 2011 2:17:42 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-05-06 Anders Carlsson <andersca@apple.com>

Reviewed by Dan Bernstein.

Make more PluginInfoStore member functions static
https://bugs.webkit.org/show_bug.cgi?id=60401

This is a first step towards making PluginInfoStore thread safe.

  • UIProcess/Plugins/PluginInfoStore.cpp: (WebKit::PluginInfoStore::loadPluginsIfNecessary): (WebKit::PluginInfoStore::loadPlugin):
  • UIProcess/Plugins/PluginInfoStore.h:
  • UIProcess/Plugins/mac/PluginInfoStoreMac.mm: (WebKit::PluginInfoStore::shouldUsePlugin):
  • UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp: (WebKit::PluginInfoStore::shouldUsePlugin):
  • UIProcess/Plugins/win/PluginInfoStoreWin.cpp: (WebKit::PluginInfoStore::shouldUsePlugin):
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r85962 r85978  
     12011-05-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Make more PluginInfoStore member functions static
     6        https://bugs.webkit.org/show_bug.cgi?id=60401
     7
     8        This is a first step towards making PluginInfoStore thread safe.
     9
     10        * UIProcess/Plugins/PluginInfoStore.cpp:
     11        (WebKit::PluginInfoStore::loadPluginsIfNecessary):
     12        (WebKit::PluginInfoStore::loadPlugin):
     13        * UIProcess/Plugins/PluginInfoStore.h:
     14        * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
     15        (WebKit::PluginInfoStore::shouldUsePlugin):
     16        * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
     17        (WebKit::PluginInfoStore::shouldUsePlugin):
     18        * UIProcess/Plugins/win/PluginInfoStoreWin.cpp:
     19        (WebKit::PluginInfoStore::shouldUsePlugin):
     20
    1212011-05-06  Adam Roben  <aroben@apple.com>
    222
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp

    r78676 r85978  
    7171        return;
    7272
    73     m_plugins.clear();
    74 
    7573    PathHashSet uniquePluginPaths;
    7674
     
    8785    addFromVector(uniquePluginPaths, individualPluginPaths());
    8886
     87    Vector<Plugin> plugins;
     88
    8989    PathHashSet::const_iterator end = uniquePluginPaths.end();
    9090    for (PathHashSet::const_iterator it = uniquePluginPaths.begin(); it != end; ++it)
    91         loadPlugin(*it);
    92 
     91        loadPlugin(plugins, *it);
     92
     93    m_plugins.swap(plugins);
    9394    m_pluginListIsUpToDate = true;
    9495}
    9596
    96 void PluginInfoStore::loadPlugin(const String& pluginPath)
     97void PluginInfoStore::loadPlugin(Vector<Plugin>& plugins, const String& pluginPath)
    9798{
    9899    Plugin plugin;
     
    101102        return;
    102103
    103     if (!shouldUsePlugin(plugin))
     104    if (!shouldUsePlugin(plugins, plugin))
    104105        return;
    105106   
    106     // Add the plug-in.
    107     m_plugins.append(plugin);
     107    plugins.append(plugin);
    108108}
    109109
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.h

    r84177 r85978  
    7676
    7777    void loadPluginsIfNecessary();
    78     void loadPlugin(const String& pluginPath);
     78    static void loadPlugin(Vector<Plugin>& plugins, const String& pluginPath);
    7979   
    80     // Platform-specific member functions
     80    // Platform-specific member functions:
    8181
    8282    // Returns paths to directories that should be searched for plug-ins (via pluginPathsInDirectory).
    8383    static Vector<String> pluginsDirectories();
     84
    8485    // Returns paths to all plug-ins in the specified directory.
    8586    static Vector<String> pluginPathsInDirectory(const String& directory);
     87
    8688    // Returns paths to individual plug-ins that won't be found via pluginsDirectories/pluginPathsInDirectory.
    8789    static Vector<String> individualPluginPaths();
     90
     91    // Load plug-in info for the plug-in with the specified path.
    8892    static bool getPluginInfo(const String& pluginPath, Plugin& plugin);
    89     bool shouldUsePlugin(const Plugin& plugin);
     93
     94    // Return whether this plug-in should be used (added to the list of plug-ins) or not.
     95    static bool shouldUsePlugin(Vector<Plugin>& alreadyLoadedPlugins, const Plugin&);
     96
     97    // Get the MIME type for the given extension.
    9098    static String getMIMETypeForExtension(const String& extension);
    9199
  • trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm

    r76991 r85978  
    7777}
    7878
    79 bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin)
     79bool PluginInfoStore::shouldUsePlugin(Vector<Plugin>& alreadyLoadedPlugins, const Plugin& plugin)
    8080{
    81     for (size_t i = 0; i < m_plugins.size(); ++i) {
    82         const Plugin& loadedPlugin = m_plugins[i];
     81    for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) {
     82        const Plugin& loadedPlugin = alreadyLoadedPlugins[i];
    8383
    8484        // If a plug-in with the same bundle identifier already exists, we don't want to load it.
  • trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp

    r85951 r85978  
    6565}
    6666
    67 bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin)
     67bool PluginInfoStore::shouldUsePlugin(Vector<Plugin>& alreadyLoadedPlugins, const Plugin& plugin)
    6868{
    6969    // We do not do any black-listing presently.
  • trunk/Source/WebKit2/UIProcess/Plugins/win/PluginInfoStoreWin.cpp

    r83772 r85978  
    339339}
    340340
    341 bool PluginInfoStore::shouldUsePlugin(const Plugin& plugin)
     341bool PluginInfoStore::shouldUsePlugin(const Vector<Plugin>& alreadyLoadedPlugins, const Plugin& plugin)
    342342{
    343343    if (plugin.info.name == "Citrix ICA Client") {
     
    374374        // Don't load the old Windows Media Player plugin if we've already loaded the new Windows
    375375        // Media Player plugin.
    376         for (size_t i = 0; i < m_plugins.size(); ++i) {
    377             if (!isNewWindowsMediaPlayerPlugin(m_plugins[i]))
     376        for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) {
     377            if (!isNewWindowsMediaPlayerPlugin(alreadyLoadedPlugins[i]))
    378378                continue;
    379379            return false;
     
    383383
    384384    if (isNewWindowsMediaPlayerPlugin(plugin)) {
    385         // Unload the old Windows Media Player plugin if we've already loaded it.
     385        // Remove the old Windows Media Player plugin if we've already added it.
    386386        for (size_t i = 0; i < m_plugins.size(); ++i) {
    387387            if (!isOldWindowsMediaPlayerPlugin(m_plugins[i]))
    388388                continue;
    389             m_plugins.remove(i);
     389            alreadyLoadedPlugins.remove(i);
    390390        }
    391391        return true;
     
    395395    // only the first. <http://webkit.org/b/58469>
    396396    String pluginFileName = pathGetFileName(plugin.path);
    397     for (size_t i = 0; i < m_plugins.size(); ++i) {
    398         Plugin& loadedPlugin = m_plugins[i];
     397    for (size_t i = 0; i < alreadyLoadedPlugins.size(); ++i) {
     398        const Plugin& loadedPlugin = alreadyLoadedPlugins[i];
    399399
    400400        // If a plug-in with the same filename already exists, we don't want to load it.
Note: See TracChangeset for help on using the changeset viewer.