Changeset 60593 in webkit
- Timestamp:
- Jun 2, 2010 7:37:58 PM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebkitplatformplugin.h
r59033 r60593 62 62 { 63 63 public: 64 inline~QWebKitPlatformPlugin() {}64 virtual ~QWebKitPlatformPlugin() {} 65 65 66 66 enum Extension { … … 68 68 }; 69 69 70 virtual bool supportsExtension(Extension extension) const = 0; 70 71 virtual QWebSelectMethod* createSelectInputMethod() const = 0; 71 virtual bool supportsExtension(Extension extension) const = 0;72 72 73 73 }; 74 74 75 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1. 0");75 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.1"); 76 76 77 77 #endif // QWEBKITPLATFORMPLUGIN_H -
trunk/WebKit/qt/ChangeLog
r60589 r60593 1 2010-06-02 Luiz Agostini <luiz.agostini@openbossa.org> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Shared platform plugin 6 https://bugs.webkit.org/show_bug.cgi?id=39968 7 8 Allow several instances of class QtPlatformPlugin to share the QWebKitPlatformPlugin 9 object provided by a plugin. 10 11 Updated plugin interface version number due to ABI breaking change. 12 13 * Api/qwebkitplatformplugin.h: 14 (QWebKitPlatformPlugin::~QWebKitPlatformPlugin): 15 * WebCoreSupport/QtPlatformPlugin.cpp: 16 (WebCore::QtPlatformPlugin::load): 17 (WebCore::QtPlatformPlugin::~QtPlatformPlugin): 18 (WebCore::QtPlatformPlugin::plugin): 19 * WebCoreSupport/QtPlatformPlugin.h: 20 * examples/platformplugin/qwebkitplatformplugin.h: 21 (QWebKitPlatformPlugin::~QWebKitPlatformPlugin): 22 1 23 2010-06-02 Raine Makelainen <raine.makelainen@nokia.com> 2 24 -
trunk/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp
r59539 r60593 86 86 // QtPlatformPlugin 87 87 88 static QWebKitPlatformPlugin* getPluginObject() 88 bool QtPlatformPlugin::load(const QString& file) 89 { 90 m_loader.setFileName(file); 91 if (!m_loader.load()) 92 return false; 93 94 QObject* obj = m_loader.instance(); 95 if (obj) { 96 m_plugin = qobject_cast<QWebKitPlatformPlugin*>(obj); 97 if (m_plugin) 98 return true; 99 } 100 101 m_loader.unload(); 102 return false; 103 } 104 105 bool QtPlatformPlugin::load() 89 106 { 90 107 const QLatin1String suffix("/webkit/"); 91 108 const QStringList paths = QCoreApplication::libraryPaths(); 92 QObject* obj = 0; 93 for (int i = 0; !obj &&i < paths.count(); ++i) {109 110 for (int i = 0; i < paths.count(); ++i) { 94 111 const QDir dir(paths[i] + suffix); 95 112 if (!dir.exists()) 96 113 continue; 97 114 const QStringList files = dir.entryList(QDir::Files); 98 for (int i = 0; i < files.count(); ++i) { 99 QPluginLoader pluginLoader(dir.absoluteFilePath(files.at(i))); 100 if (!pluginLoader.load()) 101 continue; 102 obj = pluginLoader.instance(); 103 if (obj) { 104 QWebKitPlatformPlugin* result = qobject_cast<QWebKitPlatformPlugin*>(obj); 105 if (result) 106 return result; 107 delete obj; 108 } 109 pluginLoader.unload(); 115 for (int j = 0; j < files.count(); ++j) { 116 if (load(dir.absoluteFilePath(files.at(j)))) 117 return true; 110 118 } 111 119 } 112 return 0;120 return false; 113 121 } 114 122 115 123 QtPlatformPlugin::~QtPlatformPlugin() 116 124 { 117 delete m_plugin;125 m_loader.unload(); 118 126 } 119 127 … … 122 130 if (m_loaded) 123 131 return m_plugin; 132 m_loaded = true; 124 133 125 m_loaded = true; 126 m_plugin = getPluginObject(); 134 // Plugin path is stored in a static variable to avoid searching for the plugin 135 // more then once. 136 static QString pluginPath; 137 138 if (pluginPath.isNull()) { 139 if (load()) 140 pluginPath = m_loader.fileName(); 141 } else 142 load(pluginPath); 143 127 144 return m_plugin; 128 145 } -
trunk/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h
r59033 r60593 24 24 #include "QtAbstractWebPopup.h" 25 25 #include <QObject> 26 #include <QPluginLoader> 26 27 27 28 class QWebSelectMethod; … … 56 57 bool m_loaded; 57 58 QWebKitPlatformPlugin* m_plugin; 59 QPluginLoader m_loader; 60 bool load(); 61 bool load(const QString& file); 58 62 59 63 QWebKitPlatformPlugin* plugin(); -
trunk/WebKit/qt/examples/platformplugin/qwebkitplatformplugin.h
r60285 r60593 62 62 { 63 63 public: 64 inline~QWebKitPlatformPlugin() {}64 virtual ~QWebKitPlatformPlugin() {} 65 65 66 66 enum Extension { … … 68 68 }; 69 69 70 virtual bool supportsExtension(Extension extension) const = 0; 70 71 virtual QWebSelectMethod* createSelectInputMethod() const = 0; 71 virtual bool supportsExtension(Extension extension) const = 0;72 72 73 73 }; 74 74 75 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1. 0");75 Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.1"); 76 76 77 77 #endif // QWEBKITPLATFORMPLUGIN_H
Note: See TracChangeset
for help on using the changeset viewer.