Changeset 31466 in webkit


Ignore:
Timestamp:
Mar 31, 2008 9:56:15 AM (16 years ago)
Author:
Adam Roben
Message:

Fix Bug 18208: Acid3 test 65 takes >33ms due to plugin refreshing on Windows

<http://bugs.webkit.org/show_bug.cgi?id=18208>

We now keep track of all the plugin paths found each time refresh() is
called. We'll only instantiate PluginPackages if there are new paths
or paths with changed timestamps since the last time refresh() was
called.

Reviewed by Darin Adler and Anders Carlsson.

  • plugins/PluginDatabase.cpp: (WebCore::PluginDatabase::refresh):
    • Only instantiate PluginPackages if there is a new path or a path with a changed timestamp since we last ran refresh().
    • Cache the set of plugin paths found and their timestamps for the next call to refresh().
    • Only re-register MIME types if our set of plugins changed.
  • plugins/PluginDatabase.h: Added a new member to cache plugin paths and their timestamps.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31465 r31466  
     12008-03-29  Adam Roben  <aroben@apple.com>
     2
     3        Fix Bug 18208: Acid3 test 65 takes >33ms due to plugin refreshing on
     4        Windows
     5
     6        <http://bugs.webkit.org/show_bug.cgi?id=18208>
     7
     8        We now keep track of all the plugin paths found each time refresh() is
     9        called. We'll only instantiate PluginPackages if there are new paths
     10        or paths with changed timestamps since the last time refresh() was
     11        called.
     12
     13        Reviewed by Darin Adler and Anders Carlsson.
     14
     15        * plugins/PluginDatabase.cpp:
     16        (WebCore::PluginDatabase::refresh):
     17          - Only instantiate PluginPackages if there is a new path or a path
     18            with a changed timestamp since we last ran refresh().
     19          - Cache the set of plugin paths found and their timestamps for the
     20            next call to refresh().
     21          - Only re-register MIME types if our set of plugins changed.
     22        * plugins/PluginDatabase.h: Added a new member to cache plugin paths
     23        and their timestamps.
     24
    1252008-03-29  Adam Roben  <aroben@apple.com>
    226
  • trunk/WebCore/plugins/PluginDatabase.cpp

    r31465 r31466  
    6969
    7070    if (!m_plugins.isEmpty()) {
    71         m_registeredMIMETypes.clear();
    72 
    7371        PluginSet pluginsToUnload;
    7472        getDeletedPlugins(pluginsToUnload);
     
    8482    HashSet<String> paths;
    8583    getPluginPathsInDirectories(paths);
     84
     85    HashMap<String, time_t> pathsWithTimes;
     86
     87    // We should only skip unchanged files if we didn't remove any plugins above. If we did remove
     88    // any plugins, we need to look at every plugin file so that, e.g., if the user has two versions
     89    // of RealPlayer installed and just removed the newer one, we'll pick up the older one.
     90    bool shouldSkipUnchangedFiles = !pluginSetChanged;
    8691
    8792    HashSet<String>::const_iterator pathsEnd = paths.end();
     
    9196            continue;
    9297
     98        pathsWithTimes.add(*it, lastModified);
     99
     100        // If the path's timestamp hasn't changed since the last time we ran refresh(), we don't have to do anything.
     101        if (shouldSkipUnchangedFiles && m_pluginPathsWithTimes.get(*it) == lastModified)
     102            continue;
     103
    93104        if (RefPtr<PluginPackage> oldPackage = m_pluginsByPath.get(*it)) {
    94             if (oldPackage->lastModified() == lastModified)
    95                 continue;
     105            ASSERT(!shouldSkipUnchangedFiles || oldPackage->lastModified() != lastModified);
    96106            remove(oldPackage.get());
    97107        }
     
    100110            pluginSetChanged = true;
    101111    }
     112
     113    // Cache all the paths we found with their timestamps for next time.
     114    pathsWithTimes.swap(m_pluginPathsWithTimes);
     115
     116    if (!pluginSetChanged)
     117        return false;
     118
     119    m_registeredMIMETypes.clear();
    102120
    103121    // Register plug-in MIME types
     
    111129    }
    112130
    113     return pluginSetChanged;
     131    return true;
    114132}
    115133
  • trunk/WebCore/plugins/PluginDatabase.h

    r31465 r31466  
    7777        PluginSet m_plugins;
    7878        HashMap<String, RefPtr<PluginPackage> > m_pluginsByPath;
     79        HashMap<String, time_t> m_pluginPathsWithTimes;
    7980    };
    8081
Note: See TracChangeset for help on using the changeset viewer.