Changeset 164808 in webkit


Ignore:
Timestamp:
Feb 27, 2014 9:59:16 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK][WK2] Blocks when fetching plugins information
https://bugs.webkit.org/show_bug.cgi?id=115650

Reviewed by Gustavo Noronha Silva.

Use a persistent cache to store the plugins metadata to avoid
having to load all the plugins everytime a plugin is used for the
first time.

  • GNUmakefile.am:
  • GNUmakefile.list.am:
  • PlatformGTK.cmake:
  • Shared/Plugins/Netscape/NetscapePluginModule.h:
  • Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:

(WebKit::NetscapePluginModule::parseMIMEDescription): Make this
method public.
(WebKit::NetscapePluginModule::buildMIMEDescription): Added this
helper to build the MIME description string.

  • UIProcess/Plugins/gtk/PluginInfoCache.cpp: Added.

(WebKit::PluginInfoCache::shared):
(WebKit::PluginInfoCache::PluginInfoCache):
(WebKit::PluginInfoCache::~PluginInfoCache):
(WebKit::PluginInfoCache::saveToFileIdleCallback):
(WebKit::PluginInfoCache::saveToFile):
(WebKit::PluginInfoCache::getPluginInfo):
(WebKit::PluginInfoCache::updatePluginInfo):

  • UIProcess/Plugins/gtk/PluginInfoCache.h: Added.
  • UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:

(WebKit::PluginInfoStore::getPluginInfo): Check first if we have
metadata of the plugin in the cache and update the cache if we
loaded the plugin to get its metadata.

Location:
trunk/Source/WebKit2
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r164797 r164808  
     12014-02-27  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][WK2] Blocks when fetching plugins information
     4        https://bugs.webkit.org/show_bug.cgi?id=115650
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Use a persistent cache to store the plugins metadata to avoid
     9        having to load all the plugins everytime a plugin is used for the
     10        first time.
     11
     12        * GNUmakefile.am:
     13        * GNUmakefile.list.am:
     14        * PlatformGTK.cmake:
     15        * Shared/Plugins/Netscape/NetscapePluginModule.h:
     16        * Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp:
     17        (WebKit::NetscapePluginModule::parseMIMEDescription): Make this
     18        method public.
     19        (WebKit::NetscapePluginModule::buildMIMEDescription): Added this
     20        helper to build the MIME description string.
     21        * UIProcess/Plugins/gtk/PluginInfoCache.cpp: Added.
     22        (WebKit::PluginInfoCache::shared):
     23        (WebKit::PluginInfoCache::PluginInfoCache):
     24        (WebKit::PluginInfoCache::~PluginInfoCache):
     25        (WebKit::PluginInfoCache::saveToFileIdleCallback):
     26        (WebKit::PluginInfoCache::saveToFile):
     27        (WebKit::PluginInfoCache::getPluginInfo):
     28        (WebKit::PluginInfoCache::updatePluginInfo):
     29        * UIProcess/Plugins/gtk/PluginInfoCache.h: Added.
     30        * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
     31        (WebKit::PluginInfoStore::getPluginInfo): Check first if we have
     32        metadata of the plugin in the cache and update the cache if we
     33        loaded the plugin to get its metadata.
     34
    1352014-02-27  Ryan Lortie  <desrt@desrt.ca>
    236
  • trunk/Source/WebKit2/GNUmakefile.am

    r164704 r164808  
    127127        -I$(srcdir)/Source/WebKit2/UIProcess/Notifications \
    128128        -I$(srcdir)/Source/WebKit2/UIProcess/Plugins \
     129        -I$(srcdir)/Source/WebKit2/UIProcess/Plugins/gtk \
    129130        -I$(srcdir)/Source/WebKit2/UIProcess/Plugins/unix \
    130131        -I$(srcdir)/Source/WebKit2/UIProcess/Storage \
  • trunk/Source/WebKit2/GNUmakefile.list.am

    r164779 r164808  
    867867        Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h \
    868868        Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp \
     869        Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp \
     870        Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h \
    869871        Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp \
    870872        Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp \
  • trunk/Source/WebKit2/PlatformGTK.cmake

    r164632 r164808  
    249249    UIProcess/Network/CustomProtocols/soup/WebSoupCustomProtocolRequestManager.cpp
    250250
     251    UIProcess/Plugins/gtk/PluginInfoCache.cpp
     252
    251253    UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
    252254    UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
     
    410412    "${WEBKIT2_DIR}/UIProcess/API/gtk"
    411413    "${WEBKIT2_DIR}/UIProcess/Network/CustomProtocols/soup"
     414    "${WEBKIT2_DIR}/UIProcess/Plugins/gtk"
    412415    "${WEBKIT2_DIR}/UIProcess/gtk"
    413416    "${WEBKIT2_DIR}/UIProcess/soup"
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.h

    r163178 r164808  
    3636#include <wtf/text/WTFString.h>
    3737
     38namespace WebCore {
     39struct MimeClassInfo;
     40}
     41
    3842namespace WebKit {
    3943
     
    6872#if PLUGIN_ARCHITECTURE(X11)
    6973    static bool scanPlugin(const String& pluginPath);
     74    static void parseMIMEDescription(const String& mimeDescription, Vector<WebCore::MimeClassInfo>& result);
     75    static String buildMIMEDescription(const Vector<WebCore::MimeClassInfo>&);
    7076#endif
    7177
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp

    r163258 r164808  
    3737#include <sys/types.h>
    3838#include <unistd.h>
     39#include <wtf/text/StringBuilder.h>
    3940
    4041using namespace WebCore;
     
    6869
    6970
    70 static void parseMIMEDescription(const String& mimeDescription, Vector<MimeClassInfo>& result)
     71void NetscapePluginModule::parseMIMEDescription(const String& mimeDescription, Vector<MimeClassInfo>& result)
    7172{
    7273    ASSERT_ARG(result, result.isEmpty());
     
    9394            mimeInfo.desc = mimeTypeParts[2];
    9495    }
     96}
     97
     98String NetscapePluginModule::buildMIMEDescription(const Vector<MimeClassInfo>& mimeDescription)
     99{
     100    StringBuilder builder;
     101
     102    size_t mimeInfoCount = mimeDescription.size();
     103    for (size_t i = 0; i < mimeInfoCount; ++i) {
     104        const MimeClassInfo& mimeInfo = mimeDescription[i];
     105        builder.append(mimeInfo.type);
     106        builder.append(':');
     107
     108        size_t extensionsCount = mimeInfo.extensions.size();
     109        for (size_t j = 0; j < extensionsCount; ++j) {
     110            builder.append(mimeInfo.extensions[j]);
     111            if (j != extensionsCount - 1)
     112                builder.append(',');
     113        }
     114        builder.append(':');
     115
     116        builder.append(mimeInfo.desc);
     117        if (i != mimeInfoCount - 1)
     118            builder.append(';');
     119    }
     120
     121    return builder.toString();
    95122}
    96123
  • trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp

    r149579 r164808  
    3535#include "PluginDatabase.h"
    3636#include <WebCore/FileSystem.h>
     37
     38#if PLATFORM(GTK)
     39#include "PluginInfoCache.h"
     40#endif
    3741
    3842using namespace WebCore;
     
    99103bool PluginInfoStore::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
    100104{
     105#if PLATFORM(GTK)
     106    if (PluginInfoCache::shared().getPluginInfo(pluginPath, plugin))
     107        return true;
     108
     109    if (NetscapePluginModule::getPluginInfo(pluginPath, plugin)) {
     110        PluginInfoCache::shared().updatePluginInfo(pluginPath, plugin);
     111        return true;
     112    }
     113    return false;
     114#else
    101115    return NetscapePluginModule::getPluginInfo(pluginPath, plugin);
     116#endif
    102117}
    103118
Note: See TracChangeset for help on using the changeset viewer.