Changeset 117471 in webkit


Ignore:
Timestamp:
May 17, 2012 11:48:29 AM (12 years ago)
Author:
kling@webkit.org
Message:

Make PluginInfoStore properly thread-safe.
<http://webkit.org/b/86648>
<rdar://problem/11451178>

Reviewed by Darin Adler.

Source/WebCore:

  • plugins/PluginData.h:

(WebCore::MimeClassInfo::isolatedCopy):
(WebCore::PluginInfo::isolatedCopy):

Source/WebKit2:

Deep copy the internal storage of PluginInfoStore after constructing it, as we can
be doing this from a secondary thread.

  • Shared/Plugins/PluginModuleInfo.h:

(WebKit::PluginModuleInfo::isolatedCopy):

  • UIProcess/Plugins/PluginInfoStore.cpp:

(WebKit::deepIsolatedCopyPluginInfoVector):
(WebKit::PluginInfoStore::loadPluginsIfNecessary):
(WebKit::PluginInfoStore::plugins):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117470 r117471  
     12012-05-16  Andreas Kling  <kling@webkit.org>
     2
     3        Make PluginInfoStore properly thread-safe.
     4        <http://webkit.org/b/86648>
     5        <rdar://problem/11451178>
     6
     7        Reviewed by Darin Adler.
     8
     9        * plugins/PluginData.h:
     10        (WebCore::MimeClassInfo::isolatedCopy):
     11        (WebCore::PluginInfo::isolatedCopy):
     12
    1132012-05-17  Hironori Bono  <hbono@chromium.org>
    214
  • trunk/Source/WebCore/plugins/PluginData.h

    r117108 r117471  
    3535    Vector<String> extensions;
    3636
    37     MimeClassInfo isolatedCopy()
     37    MimeClassInfo isolatedCopy() const
    3838    {
    3939        MimeClassInfo clone;
     
    5757    Vector<MimeClassInfo> mimes;
    5858
    59     PluginInfo isolatedCopy()
     59    PluginInfo isolatedCopy() const
    6060    {
    6161        PluginInfo clone;
  • trunk/Source/WebKit2/ChangeLog

    r117470 r117471  
     12012-05-16  Andreas Kling  <kling@webkit.org>
     2
     3        Make PluginInfoStore properly thread-safe.
     4        <http://webkit.org/b/86648>
     5        <rdar://problem/11451178>
     6
     7        Reviewed by Darin Adler.
     8
     9        Deep copy the internal storage of PluginInfoStore after constructing it, as we can
     10        be doing this from a secondary thread.
     11
     12        * Shared/Plugins/PluginModuleInfo.h:
     13        (WebKit::PluginModuleInfo::isolatedCopy):
     14        * UIProcess/Plugins/PluginInfoStore.cpp:
     15        (WebKit::deepIsolatedCopyPluginInfoVector):
     16        (WebKit::PluginInfoStore::loadPluginsIfNecessary):
     17        (WebKit::PluginInfoStore::plugins):
     18
    1192012-05-17  Hironori Bono  <hbono@chromium.org>
    220
  • trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h

    r117108 r117471  
    4343#endif
    4444
    45     PluginModuleInfo isolatedCopy()
     45    PluginModuleInfo isolatedCopy() const
    4646    {
    4747        PluginModuleInfo clone;
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginInfoStore.cpp

    r117108 r117471  
    7070#endif
    7171
     72static inline Vector<PluginModuleInfo> deepIsolatedCopyPluginInfoVector(const Vector<PluginModuleInfo>& vector)
     73{
     74    // Let the copy begin!
     75    Vector<PluginModuleInfo> copy;
     76    copy.reserveCapacity(vector.size());
     77    for (unsigned i = 0; i < vector.size(); ++i)
     78        copy.append(vector[i].isolatedCopy());
     79    return copy;
     80}
     81
    7282void PluginInfoStore::loadPluginsIfNecessary()
    7383{
     
    95105        loadPlugin(plugins, *it);
    96106
    97     m_plugins.swap(plugins);
     107    m_plugins = deepIsolatedCopyPluginInfoVector(plugins);
     108
    98109    m_pluginListIsUpToDate = true;
    99110}
     
    116127    MutexLocker locker(m_pluginsLock);
    117128    loadPluginsIfNecessary();
    118 
    119     // Let the copy begin!
    120     Vector<PluginModuleInfo> infos;
    121     for (unsigned i = 0; i < m_plugins.size(); ++i)
    122         infos.append(m_plugins[i].isolatedCopy());
    123 
    124     return infos;
     129    return deepIsolatedCopyPluginInfoVector(m_plugins);
    125130}
    126131
Note: See TracChangeset for help on using the changeset viewer.