Changeset 66297 in webkit


Ignore:
Timestamp:
Aug 27, 2010 9:32:17 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] NPAPI Plugin metadata should be cached, and loading a plugin should not require loading every plugin
https://bugs.webkit.org/show_bug.cgi?id=43179

Add ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE flag to enable persistent
NPAPI Plugin Cache. The flag is enabled by default.

  • wtf/Platform.h: Add ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE

2010-08-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Cache plugin info to a persistent database

https://bugs.webkit.org/show_bug.cgi?id=43179

Implement a cache of NPAPI plugin metadata. Write the metadata to aa
file that gets rewritten if any plugin is added / removed. Compilation
of the feature is controlled by #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)

Currently only enabled for Qt UNIX flavors.

  • WebCore.pro: Enable NETSCAPE_PLUGIN_METADATA_CACHE for UNIX builds
  • platform/qt/FileSystemQt.cpp: (WebCore::openFile): Added. (WebCore::readFromFile): Added.
  • plugins/PluginDatabase.cpp: (WebCore::persistentPluginMetadataCachePath): Static accessor for the path (WebCore::PluginDatabase::PluginDatabase): Add instance variable. (WebCore::PluginDatabase::refresh): (WebCore::PluginDatabase::pluginForMIMEType): Ensure returned plugin is loaded. (WebCore::PluginDatabase::MIMETypeForExtension): Ensure returned plugin is loaded. (WebCore::PluginDatabase::clear): (WebCore::fillBufferWithContentsOfFile): Static helper function. (WebCore::readUTF8String): Static helper function. (WebCore::readTime): Static helper function. (WebCore::PluginDatabase::loadPersistentMetadataCache): (WebCore::writeUTF8String): Static helper function. (WebCore::writeTime): Static helper function. (WebCore::PluginDatabase::updatePersistentMetadataCache): Added. (WebCore::PluginDatabase::isPersistentMetadataCacheEnabled): Added. (WebCore::PluginDatabase::setPersistentMetadataCacheEnabled):Added. (WebCore::PluginDatabase::persistentMetadataCachePath): Added. (WebCore::PluginDatabase::setPersistentMetadataCachePath): Added.
  • plugins/PluginDatabase.h:
  • plugins/PluginPackage.cpp: (WebCore::PluginPackage::PluginPackage): Add instance variable. (WebCore::PluginPackage::createPackageFromCache): Added. (WebCore::PluginPackage::ensurePluginLoaded): Added.
  • plugins/PluginPackage.h: (WebCore::PluginPackage::fullMIMEDescription): Added.
  • plugins/qt/PluginPackageQt.cpp: (WebCore::PluginPackage::fetchInfo): Split mime parsing. (WebCore::PluginPackage::setMIMEDescription): Added. Mime parsing.

2010-08-27 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Cache plugin info to a persistent database

https://bugs.webkit.org/show_bug.cgi?id=43179

Implement a cache of NPAPI plugin metadata. Write the metadata to aa
file that gets rewritten if any plugin is added / removed. Compilation
of the feature is controlled by #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)

Currently only enabled for Qt UNIX flavors.

  • Api/qwebplugindatabase.cpp: (QWebPluginDatabase::plugins): Match previous behavior: ensure all returned plugins are loaded.
  • Api/qwebsettings.cpp: (QWebSettings::enablePersistentStorage): Set plugin cache path.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r66251 r66297  
     12010-08-27  Kimmo Kinnunen  <kimmo.t.kinnunen@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] NPAPI Plugin metadata should be cached, and loading a plugin should not require loading every plugin
     6        https://bugs.webkit.org/show_bug.cgi?id=43179
     7
     8        Add ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE flag to enable persistent
     9        NPAPI Plugin Cache. The flag is enabled by default.
     10
     11        * wtf/Platform.h: Add ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE
     12
    1132010-07-27  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/JavaScriptCore/wtf/Platform.h

    r66251 r66297  
    858858#endif
    859859
     860#if !defined(ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE)
     861#define ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE 0
     862#endif
     863
    860864#if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
    861865#define WTF_USE_PLUGIN_HOST_PROCESS 0
  • trunk/WebCore/ChangeLog

    r66296 r66297  
     12010-08-27  Kimmo Kinnunen  <kimmo.t.kinnunen@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Cache plugin info to a persistent database
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=43179
     8
     9        Implement a cache of NPAPI plugin metadata. Write the metadata to aa
     10        file that gets rewritten if any plugin is added / removed.  Compilation
     11        of the feature is controlled by #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     12
     13        Currently only enabled for Qt UNIX flavors.
     14
     15        * WebCore.pro:  Enable NETSCAPE_PLUGIN_METADATA_CACHE for UNIX builds
     16        * platform/qt/FileSystemQt.cpp:
     17        (WebCore::openFile): Added.
     18        (WebCore::readFromFile): Added.
     19        * plugins/PluginDatabase.cpp:
     20        (WebCore::persistentPluginMetadataCachePath): Static accessor for the path
     21        (WebCore::PluginDatabase::PluginDatabase): Add instance variable.
     22        (WebCore::PluginDatabase::refresh):
     23        (WebCore::PluginDatabase::pluginForMIMEType): Ensure returned plugin is loaded.
     24        (WebCore::PluginDatabase::MIMETypeForExtension): Ensure returned plugin is loaded.
     25        (WebCore::PluginDatabase::clear):
     26        (WebCore::fillBufferWithContentsOfFile): Static helper function.
     27        (WebCore::readUTF8String): Static helper function.
     28        (WebCore::readTime): Static helper function.
     29        (WebCore::PluginDatabase::loadPersistentMetadataCache):
     30        (WebCore::writeUTF8String): Static helper function.
     31        (WebCore::writeTime): Static helper function.
     32        (WebCore::PluginDatabase::updatePersistentMetadataCache): Added.
     33        (WebCore::PluginDatabase::isPersistentMetadataCacheEnabled): Added.
     34        (WebCore::PluginDatabase::setPersistentMetadataCacheEnabled):Added.
     35        (WebCore::PluginDatabase::persistentMetadataCachePath): Added.
     36        (WebCore::PluginDatabase::setPersistentMetadataCachePath): Added.
     37        * plugins/PluginDatabase.h:
     38        * plugins/PluginPackage.cpp:
     39        (WebCore::PluginPackage::PluginPackage): Add instance variable.
     40        (WebCore::PluginPackage::createPackageFromCache): Added.
     41        (WebCore::PluginPackage::ensurePluginLoaded): Added.
     42        * plugins/PluginPackage.h:
     43        (WebCore::PluginPackage::fullMIMEDescription): Added.
     44        * plugins/qt/PluginPackageQt.cpp:
     45        (WebCore::PluginPackage::fetchInfo): Split mime parsing.
     46        (WebCore::PluginPackage::setMIMEDescription): Added. Mime parsing.
     47
    1482010-08-27  Daniel Bates  <dbates@rim.com>
    249
  • trunk/WebCore/WebCore.pro

    r66277 r66297  
    23952395                    plugins/qt/PluginContainerQt.h
    23962396                DEFINES += XP_UNIX
     2397                DEFINES += ENABLE_NETSCAPE_PLUGIN_METADATA_CACHE=1
    23972398            }
    23982399        }
  • trunk/WebCore/platform/qt/FileSystemQt.cpp

    r64816 r66297  
    129129}
    130130
     131#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     132PlatformFileHandle openFile(const String& path, FileOpenMode mode)
     133{
     134    QIODevice::OpenMode platformMode;
     135
     136    if (mode == OpenForRead)
     137        platformMode = QIODevice::ReadOnly;
     138    else if (mode == OpenForWrite)
     139        platformMode = (QIODevice::WriteOnly | QIODevice::Truncate);
     140    else
     141        return invalidPlatformFileHandle;
     142
     143    QFile* file = new QFile(path);
     144    if (file->open(platformMode))
     145        return file;
     146
     147    return invalidPlatformFileHandle;
     148}
     149
     150int readFromFile(PlatformFileHandle handle, char* data, int length)
     151{
     152    if (handle && handle->exists() && handle->isReadable())
     153        return handle->read(data, length);
     154    return 0;
     155}
     156#endif
     157
    131158void closeFile(PlatformFileHandle& handle)
    132159{
  • trunk/WebCore/plugins/PluginDatabase.cpp

    r60187 r66297  
    3131#include "KURL.h"
    3232#include "PluginPackage.h"
     33#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     34#include "FileSystem.h"
     35#endif
    3336#include <stdlib.h>
    3437
     
    3740typedef HashMap<String, RefPtr<PluginPackage> > PluginPackageByNameMap;
    3841
     42#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     43static const size_t maximumPersistentPluginMetadataCacheSize = 32768;
     44
     45static bool gPersistentPluginMetadataCacheIsEnabled;
     46
     47String& persistentPluginMetadataCachePath()
     48{
     49    DEFINE_STATIC_LOCAL(String, cachePath, ());
     50    return cachePath;
     51}
     52#endif
     53
    3954PluginDatabase::PluginDatabase()
     55#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     56    : m_persistentMetadataCacheIsLoaded(false)
     57#endif
    4058{
    4159}
     
    7593bool PluginDatabase::refresh()
    7694{
     95#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     96    if (!m_persistentMetadataCacheIsLoaded)
     97        loadPersistentMetadataCache();
     98#endif
    7799    bool pluginSetChanged = false;
    78100
     
    126148    if (!pluginSetChanged)
    127149        return false;
     150
     151#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     152    updatePersistentMetadataCache();
     153#endif
    128154
    129155    m_registeredMIMETypes.clear();
     
    183209            continue;
    184210
    185         if (plugin->mimeToDescriptions().contains(key))
     211        if (plugin->mimeToDescriptions().contains(key)) {
     212#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     213            if (!plugin->ensurePluginLoaded())
     214                continue;
     215#endif
    186216            pluginChoices.append(plugin);
     217        }
    187218    }
    188219
     
    223254                        return mimeType;
    224255
     256#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     257                    if (!plugin->ensurePluginLoaded())
     258                        continue;
     259#endif
    225260                    pluginChoices.append(plugin);
    226261                    mimeTypeForPlugin.add(plugin, mimeType);
     
    316351    m_registeredMIMETypes.clear();
    317352    m_preferredPlugins.clear();
     353#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     354    m_persistentMetadataCacheIsLoaded = false;
     355#endif
    318356}
    319357
     
    428466#endif // !OS(SYMBIAN) && !OS(WINDOWS)
    429467
    430 }
     468#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     469
     470static void fillBufferWithContentsOfFile(PlatformFileHandle file, Vector<char>& buffer)
     471{
     472    size_t bufferSize = 0;
     473    size_t bufferCapacity = 1024;
     474    buffer.resize(bufferCapacity);
     475
     476    do {
     477        bufferSize += readFromFile(file, buffer.data() + bufferSize, bufferCapacity - bufferSize);
     478        if (bufferSize == bufferCapacity) {
     479            if (bufferCapacity < maximumPersistentPluginMetadataCacheSize) {
     480                bufferCapacity *= 2;
     481                buffer.resize(bufferCapacity);
     482            } else {
     483                buffer.clear();
     484                return;
     485            }
     486        } else
     487            break;
     488    } while (true);
     489
     490    buffer.shrink(bufferSize);
     491}
     492
     493static bool readUTF8String(String& resultString, char*& start, const char* end)
     494{
     495    if (start >= end)
     496        return false;
     497
     498    int len = strlen(start);
     499    resultString = String::fromUTF8(start, len);
     500    start += len + 1;
     501
     502    return true;
     503}
     504
     505static bool readTime(time_t& resultTime, char*& start, const char* end)
     506{
     507    if (start + sizeof(time_t) >= end)
     508        return false;
     509
     510    resultTime = *reinterpret_cast<time_t*>(start);
     511    start += sizeof(time_t);
     512
     513    return true;
     514}
     515
     516static const char schemaVersion = '1';
     517static const char persistentPluginMetadataCacheFilename[] = "PluginMetadataCache.bin";
     518
     519void PluginDatabase::loadPersistentMetadataCache()
     520{
     521    if (!isPersistentMetadataCacheEnabled() || persistentMetadataCachePath().isEmpty())
     522        return;
     523
     524    PlatformFileHandle file;
     525    String absoluteCachePath = pathByAppendingComponent(persistentMetadataCachePath(), persistentPluginMetadataCacheFilename);
     526    file = openFile(absoluteCachePath, OpenForRead);
     527
     528    if (!isHandleValid(file))
     529        return;
     530
     531    // Mark cache as loaded regardless of success or failure. If
     532    // there's error in the cache, we won't try to load it anymore.
     533    m_persistentMetadataCacheIsLoaded = true;
     534
     535    Vector<char> fileContents;
     536    fillBufferWithContentsOfFile(file, fileContents);
     537    closeFile(file);
     538
     539    if (fileContents.size() < 2 || fileContents.first() != schemaVersion || fileContents.last() != '\0') {
     540        LOG_ERROR("Unable to read plugin metadata cache: corrupt schema");
     541        deleteFile(absoluteCachePath);
     542        return;
     543    }
     544
     545    char* bufferPos = fileContents.data() + 1;
     546    char* end = fileContents.data() + fileContents.size();
     547
     548    PluginSet cachedPlugins;
     549    HashMap<String, time_t> cachedPluginPathsWithTimes;
     550    HashMap<String, RefPtr<PluginPackage> > cachedPluginsByPath;
     551
     552    while (bufferPos < end) {
     553        String path;
     554        time_t lastModified;
     555        String name;
     556        String desc;
     557        String mimeDesc;
     558        if (!(readUTF8String(path, bufferPos, end)
     559              && readTime(lastModified, bufferPos, end)
     560              && readUTF8String(name, bufferPos, end)
     561              && readUTF8String(desc, bufferPos, end)
     562              && readUTF8String(mimeDesc, bufferPos, end))) {
     563            LOG_ERROR("Unable to read plugin metadata cache: corrupt data");
     564            deleteFile(absoluteCachePath);
     565            return;
     566        }
     567
     568        // Skip metadata that points to plugins from directories that
     569        // are not part of plugin directory list anymore.
     570        String pluginDirectoryName = directoryName(path);
     571        if (m_pluginDirectories.find(pluginDirectoryName) == WTF::notFound)
     572            continue;
     573
     574        RefPtr<PluginPackage> package = PluginPackage::createPackageFromCache(path, lastModified, name, desc, mimeDesc);
     575
     576        if (package && cachedPlugins.add(package).second) {
     577            cachedPluginPathsWithTimes.add(package->path(), package->lastModified());
     578            cachedPluginsByPath.add(package->path(), package);
     579        }
     580    }
     581
     582    m_plugins.swap(cachedPlugins);
     583    m_pluginsByPath.swap(cachedPluginsByPath);
     584    m_pluginPathsWithTimes.swap(cachedPluginPathsWithTimes);
     585}
     586
     587static bool writeUTF8String(PlatformFileHandle file, const String& string)
     588{
     589    CString utf8String = string.utf8();
     590    int length = utf8String.length() + 1;
     591    return writeToFile(file, utf8String.data(), length) == length;
     592}
     593
     594static bool writeTime(PlatformFileHandle file, const time_t& time)
     595{
     596    return writeToFile(file, reinterpret_cast<const char*>(&time), sizeof(time_t)) == sizeof(time_t);
     597}
     598
     599void PluginDatabase::updatePersistentMetadataCache()
     600{
     601    if (!isPersistentMetadataCacheEnabled() || persistentMetadataCachePath().isEmpty())
     602        return;
     603
     604    makeAllDirectories(persistentMetadataCachePath());
     605    String absoluteCachePath = pathByAppendingComponent(persistentMetadataCachePath(), persistentPluginMetadataCacheFilename);
     606    deleteFile(absoluteCachePath);
     607
     608    if (m_plugins.isEmpty())
     609        return;
     610
     611    PlatformFileHandle file;
     612    file = openFile(absoluteCachePath, OpenForWrite);
     613
     614    if (!isHandleValid(file)) {
     615        LOG_ERROR("Unable to open plugin metadata cache for saving");
     616        return;
     617    }
     618
     619    char localSchemaVersion = schemaVersion;
     620    if (writeToFile(file, &localSchemaVersion, 1) != 1) {
     621        LOG_ERROR("Unable to write plugin metadata cache schema");
     622        closeFile(file);
     623        deleteFile(absoluteCachePath);
     624        return;
     625    }
     626
     627    PluginSet::const_iterator end = m_plugins.end();
     628    for (PluginSet::const_iterator it = m_plugins.begin(); it != end; ++it) {
     629        if (!(writeUTF8String(file, (*it)->path())
     630              && writeTime(file, (*it)->lastModified())
     631              && writeUTF8String(file, (*it)->name())
     632              && writeUTF8String(file, (*it)->description())
     633              && writeUTF8String(file, (*it)->fullMIMEDescription()))) {
     634            LOG_ERROR("Unable to write plugin metadata to cache");
     635            closeFile(file);
     636            deleteFile(absoluteCachePath);
     637            return;
     638        }
     639    }
     640
     641    closeFile(file);
     642}
     643
     644bool PluginDatabase::isPersistentMetadataCacheEnabled()
     645{
     646    return gPersistentPluginMetadataCacheIsEnabled;
     647}
     648
     649void PluginDatabase::setPersistentMetadataCacheEnabled(bool isEnabled)
     650{
     651    gPersistentPluginMetadataCacheIsEnabled = isEnabled;
     652}
     653
     654String PluginDatabase::persistentMetadataCachePath()
     655{
     656    return WebCore::persistentPluginMetadataCachePath();
     657}
     658
     659void PluginDatabase::setPersistentMetadataCachePath(const String& persistentMetadataCachePath)
     660{
     661    WebCore::persistentPluginMetadataCachePath() = persistentMetadataCachePath;
     662}
     663#endif
     664}
  • trunk/WebCore/plugins/PluginDatabase.h

    r65077 r66297  
    7979
    8080        String MIMETypeForExtension(const String& extension) const;
     81#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     82        static bool isPersistentMetadataCacheEnabled();
     83        static void setPersistentMetadataCacheEnabled(bool isEnabled);
     84        static String persistentMetadataCachePath();
     85        static void setPersistentMetadataCachePath(const String& persistentMetadataCachePath);
     86#endif
    8187
    8288    private:
     
    8793        bool add(PassRefPtr<PluginPackage>);
    8894        void remove(PluginPackage*);
     95#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     96        void loadPersistentMetadataCache();
     97        void updatePersistentMetadataCache();
     98#endif
    8999
    90100        Vector<String> m_pluginDirectories;
     
    94104        HashMap<String, time_t> m_pluginPathsWithTimes;
    95105        HashMap<String, RefPtr<PluginPackage> > m_preferredPlugins;
     106#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     107        bool m_persistentMetadataCacheIsLoaded;
     108#endif
    96109    };
    97110
  • trunk/WebCore/plugins/PluginPackage.cpp

    r65524 r66297  
    109109    , m_lastModified(lastModified)
    110110    , m_freeLibraryTimer(this, &PluginPackage::freeLibraryTimerFired)
     111#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     112    , m_infoIsFromCache(true)
     113#endif
    111114{
    112115    m_fileName = pathGetFileName(m_path);
     
    162165    return package.release();
    163166}
     167
     168#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     169PassRefPtr<PluginPackage> PluginPackage::createPackageFromCache(const String& path, const time_t& lastModified, const String& name, const String& description, const String& mimeDescription)
     170{
     171    RefPtr<PluginPackage> package = adoptRef(new PluginPackage(path, lastModified));
     172    package->m_name = name;
     173    package->m_description = description;
     174    package->determineModuleVersionFromDescription();
     175    package->setMIMEDescription(mimeDescription);
     176    package->m_infoIsFromCache = true;
     177    return package.release();
     178}
     179#endif
    164180
    165181#if defined(XP_UNIX)
     
    344360}
    345361
    346 }
     362#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     363bool PluginPackage::ensurePluginLoaded()
     364{
     365    if (!m_infoIsFromCache)
     366        return m_isLoaded;
     367
     368    m_quirks = PluginQuirkSet();
     369    m_name = String();
     370    m_description = String();
     371    m_fullMIMEDescription = String();
     372    m_moduleVersion = 0;
     373
     374    return fetchInfo();
     375}
     376#endif
     377
     378}
  • trunk/WebCore/plugins/PluginPackage.h

    r65077 r66297  
    5050        ~PluginPackage();
    5151        static PassRefPtr<PluginPackage> createPackage(const String& path, const time_t& lastModified);
     52#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     53        static PassRefPtr<PluginPackage> createPackageFromCache(const String& path, const time_t& lastModified, const String& name, const String& description, const String& mimeDescription);
     54#endif
    5255
    5356        const String& name() const { return m_name; }
     
    8184#endif // OS(SYMBIAN)
    8285
     86#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     87        bool ensurePluginLoaded();
     88        void setMIMEDescription(const String& mimeDescription);
     89        String fullMIMEDescription() const { return m_fullMIMEDescription;}
     90#endif
    8391    private:
    8492        PluginPackage(const String& path, const time_t& lastModified);
     
    122130
    123131        PluginQuirkSet m_quirks;
     132#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     133        String m_fullMIMEDescription;
     134        bool m_infoIsFromCache;
     135#endif
    124136    };
    125137
  • trunk/WebCore/plugins/qt/PluginPackageQt.cpp

    r66017 r66297  
    6161    determineModuleVersionFromDescription();
    6262
    63     String s = gm();
     63    String mimeDescription = gm();
     64    setMIMEDescription(mimeDescription);
     65    m_infoIsFromCache = false;
     66
     67    return true;
     68}
     69
     70void PluginPackage::setMIMEDescription(const String& mimeDescription)
     71{
     72    m_fullMIMEDescription = mimeDescription;
     73
    6474    Vector<String> types;
    65     s.split(UChar(';'), false, types);
     75    mimeDescription.split(UChar(';'), false, types);
    6676    for (unsigned i = 0; i < types.size(); ++i) {
    6777        Vector<String> mime;
     
    7787        }
    7888    }
    79 
    80     return true;
    8189}
    8290
     
    188196    return NP_VERSION_MINOR;
    189197}
     198
    190199}
  • trunk/WebKit/qt/Api/qwebplugindatabase.cpp

    r50456 r66297  
    285285    for (unsigned int i = 0; i < plugins.size(); ++i) {
    286286        PluginPackage* plugin = plugins[i];
    287         qwebplugins.append(QWebPluginInfo(plugin));
     287        if (plugin->ensurePluginLoaded())
     288            qwebplugins.append(QWebPluginInfo(plugin));
    288289    }
    289290
  • trunk/WebKit/qt/Api/qwebsettings.cpp

    r65234 r66297  
    3535#include "PlatformString.h"
    3636#include "IconDatabase.h"
     37#include "PluginDatabase.h"
    3738#include "Image.h"
    3839#include "IntSize.h"
     
    10941095    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    10951096    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, true);
     1097
     1098#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     1099    QFileInfo info(storagePath);
     1100    if (info.isDir() && info.isWritable()) {
     1101        WebCore::PluginDatabase::setPersistentMetadataCacheEnabled(true);
     1102        WebCore::PluginDatabase::setPersistentMetadataCachePath(storagePath);
     1103    }
     1104#endif
    10961105}
    10971106
  • trunk/WebKit/qt/ChangeLog

    r66241 r66297  
     12010-08-27  Kimmo Kinnunen  <kimmo.t.kinnunen@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Cache plugin info to a persistent database
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=43179
     8
     9        Implement a cache of NPAPI plugin metadata. Write the metadata to aa
     10        file that gets rewritten if any plugin is added / removed.  Compilation
     11        of the feature is controlled by #if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
     12
     13        Currently only enabled for Qt UNIX flavors.
     14
     15        * Api/qwebplugindatabase.cpp:
     16        (QWebPluginDatabase::plugins):  Match previous behavior: ensure all returned plugins are loaded.
     17        * Api/qwebsettings.cpp:
     18        (QWebSettings::enablePersistentStorage): Set plugin cache path.
     19
    1202010-08-27  Benjamin Poulain  <benjamin.poulain@nokia.com>
    221
Note: See TracChangeset for help on using the changeset viewer.