Diff
Modified: trunk/Source/WebKit2/ChangeLog (93783 => 93784)
--- trunk/Source/WebKit2/ChangeLog 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-25 15:13:39 UTC (rev 93784)
@@ -1,3 +1,39 @@
+2011-08-25 Alexis Menard <[email protected]>
+
+ [Qt][WK2] Remove QWKContext class and make sure the WebProcessProxy life is correctly managed.
+ https://bugs.webkit.org/show_bug.cgi?id=66886
+
+ Reviewed by Benjamin Poulain.
+
+ Remove QWKContext class from Qt APIs as it is too low level for the vision
+ of the Qt5 API. QtWebPageProxy now holds directly a WebContext which can be a custom one
+ or default created one. This patch also ensure that the WebProcessProxy is correctly
+ destroyed at application exit by removing the circular references between the WebContext,
+ WebProcessProxy, and WebPageProxy.
+
+ * UIProcess/API/qt/qdesktopwebview.cpp:
+ (QDesktopWebViewPrivate::QDesktopWebViewPrivate):
+ * UIProcess/API/qt/qtouchwebview.cpp:
+ (QTouchWebViewPrivate::QTouchWebViewPrivate):
+ * UIProcess/qt/ClientImpl.cpp:
+ (qt_wk_setStatusText):
+ * UIProcess/qt/ClientImpl.h:
+ * UIProcess/qt/QtWebPageProxy.cpp:
+ (QtWebPageProxy::defaultWKContext):
+ (QtWebPageProxy::QtWebPageProxy):
+ (QtWebPageProxy::~QtWebPageProxy):
+ * UIProcess/qt/QtWebPageProxy.h:
+ * UIProcess/qt/qdesktopwebpageproxy.cpp:
+ (QDesktopWebPageProxy::QDesktopWebPageProxy):
+ * UIProcess/qt/qdesktopwebpageproxy.h:
+ * UIProcess/qt/qtouchwebpageproxy.cpp:
+ (QTouchWebPageProxy::QTouchWebPageProxy):
+ * UIProcess/qt/qtouchwebpageproxy.h:
+ * UIProcess/qt/qwkcontext.cpp: Removed.
+ * UIProcess/qt/qwkcontext.h: Removed.
+ * UIProcess/qt/qwkcontext_p.h: Removed.
+ * WebKit2.pro:
+
2011-08-23 Jocelyn Turcotte <[email protected]>
[Qt][WK2] Drive tiling from the WebProcess and reuse TiledBackingStore.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -21,7 +21,6 @@
#include "config.h"
#include "qdesktopwebview.h"
#include "qdesktopwebview_p.h"
-#include "qwkcontext.h"
#include <QGraphicsSceneResizeEvent>
#include <QStyleOptionGraphicsItem>
@@ -39,7 +38,7 @@
QDesktopWebViewPrivate::QDesktopWebViewPrivate(QDesktopWebView* q, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
: q(q)
- , page(this, contextRef ? new QWKContext(contextRef) : defaultWKContext(), pageGroupRef)
+ , page(this, contextRef, pageGroupRef)
, isCrashed(false)
, navigationController(0)
{
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -34,7 +34,7 @@
, pageView(new QTouchWebPage(q))
, viewInterface(q, pageView.data())
, interactionEngine(q, pageView.data())
- , page(&viewInterface, &interactionEngine, defaultWKContext())
+ , page(&viewInterface, &interactionEngine)
{
QTouchWebPagePrivate* const pageViewPrivate = pageView.data()->d;
pageViewPrivate->setPage(&page);
Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -27,7 +27,6 @@
#include "qweberror.h"
#include "qweberror_p.h"
#include <PolicyInterface.h>
-#include <qwkcontext.h>
#include <QtWebPageProxy.h>
#include <ViewInterface.h>
#include <WKFrame.h>
@@ -37,13 +36,6 @@
using namespace WebKit;
-static QWKContext* toQWKContext(const void* clientInfo)
-{
- if (clientInfo)
- return reinterpret_cast<QWKContext*>(const_cast<void*>(clientInfo));
- return 0;
-}
-
static QtWebPageProxy* toQtWebPageProxy(const void* clientInfo)
{
if (clientInfo)
@@ -155,16 +147,6 @@
toViewInterface(clientInfo)->didChangeStatusText(qText);
}
-void qt_wk_didChangeIconForPageURL(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo)
-{
- QUrl qUrl = WKURLCopyQUrl(pageURL);
- emit toQWKContext(clientInfo)->iconChangedForPageURL(qUrl);
-}
-
-void qt_wk_didRemoveAllIcons(WKIconDatabaseRef iconDatabase, const void* clientInfo)
-{
-}
-
static Qt::MouseButton toQtMouseButton(WKEventMouseButton button)
{
switch (button) {
Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.h 2011-08-25 15:13:39 UTC (rev 93784)
@@ -41,10 +41,6 @@
// ui client
void qt_wk_setStatusText(WKPageRef page, WKStringRef text, const void *clientInfo);
-// IconDatabase client.
-void qt_wk_didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef, const void* clientInfo);
-void qt_wk_didRemoveAllIcons(WKIconDatabaseRef, const void* clientInfo);
-
// Policy client.
void qt_wk_decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef userData, const void* clientInfo);
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -24,8 +24,6 @@
#include "qwkpreferences_p.h"
#include "ClientImpl.h"
-#include "qwkcontext.h"
-#include "qwkcontext_p.h"
#include "qwkhistory.h"
#include "qwkhistory_p.h"
#include "ViewInterface.h"
@@ -61,10 +59,16 @@
using namespace WebKit;
using namespace WebCore;
-QWKContext* defaultWKContext()
+
+RefPtr<WebContext> QtWebPageProxy::s_defaultContext;
+
+unsigned QtWebPageProxy::s_defaultPageProxyCount = 0;
+
+PassRefPtr<WebContext> QtWebPageProxy::defaultWKContext()
{
- static QWKContext* defaultContext = new QWKContext();
- return defaultContext;
+ if (!s_defaultContext)
+ s_defaultContext = WebContext::create(String());
+ return s_defaultContext;
}
static inline Qt::DropActions dragOperationToDropActions(unsigned dragOperations)
@@ -95,18 +99,20 @@
return (DragOperation)result;
}
-QtWebPageProxy::QtWebPageProxy(ViewInterface* viewInterface, PolicyInterface* policyInterface, QWKContext* c, WKPageGroupRef pageGroupRef)
+QtWebPageProxy::QtWebPageProxy(ViewInterface* viewInterface, PolicyInterface* policyInterface, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
: m_viewInterface(viewInterface)
, m_policyInterface(policyInterface)
- , m_context(c)
+ , m_context(contextRef ? toImpl(contextRef) : defaultWKContext())
, m_preferences(0)
, m_undoStack(adoptPtr(new QUndoStack(this)))
, m_loadProgress(0)
{
ASSERT(viewInterface);
memset(m_actions, 0, sizeof(m_actions));
- m_webPageProxy = m_context->d->context->createWebPage(this, toImpl(pageGroupRef));
+ m_webPageProxy = m_context->createWebPage(this, toImpl(pageGroupRef));
m_history = QWKHistoryPrivate::createHistory(this, m_webPageProxy->backForwardList());
+ if (!contextRef)
+ s_defaultPageProxyCount++;
}
void QtWebPageProxy::init()
@@ -204,6 +210,14 @@
QtWebPageProxy::~QtWebPageProxy()
{
m_webPageProxy->close();
+ m_context->disconnectProcess(m_context->process());
+ // The context is the default one and we're deleting the last QtWebPageProxy.
+ if (m_context == s_defaultContext) {
+ ASSERT(s_defaultPageProxyCount > 0);
+ s_defaultPageProxyCount--;
+ if (!s_defaultPageProxyCount)
+ s_defaultContext.clear();
+ }
delete m_history;
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h 2011-08-25 15:13:39 UTC (rev 93784)
@@ -30,6 +30,7 @@
#include "ShareableBitmap.h"
#include "ViewportArguments.h"
#include "ViewInterface.h"
+#include "WebContext.h"
#include "WebPageProxy.h"
#include <wtf/RefPtr.h>
#include <QBasicTimer>
@@ -42,14 +43,11 @@
class QUndoStack;
QT_END_NAMESPACE
-class QWKContext;
class QWKHistory;
class QWKPreferences;
using namespace WebKit;
-QWKContext *defaultWKContext();
-
WebCore::DragOperation dropActionToDragOperation(Qt::DropActions actions);
// FIXME: needs focus in/out, window activation, support through viewStateDidChange().
@@ -71,7 +69,7 @@
WebActionCount
};
- QtWebPageProxy(WebKit::ViewInterface*, WebKit::PolicyInterface*, QWKContext*, WKPageGroupRef = 0);
+ QtWebPageProxy(WebKit::ViewInterface*, WebKit::PolicyInterface* = 0, WKContextRef = 0, WKPageGroupRef = 0);
~QtWebPageProxy();
virtual bool handleEvent(QEvent*);
@@ -196,7 +194,11 @@
bool handleFocusInEvent(QFocusEvent*);
bool handleFocusOutEvent(QFocusEvent*);
- QWKContext* m_context;
+ static PassRefPtr<WebContext> defaultWKContext();
+ static RefPtr<WebContext> s_defaultContext;
+ static unsigned s_defaultPageProxyCount;
+
+ RefPtr<WebContext> m_context;
QWKHistory* m_history;
mutable QAction* m_actions[QtWebPageProxy::WebActionCount];
Modified: trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -47,7 +47,7 @@
return result;
}
-QDesktopWebPageProxy::QDesktopWebPageProxy(QDesktopWebViewPrivate* desktopWebView, QWKContext* context, WKPageGroupRef pageGroup)
+QDesktopWebPageProxy::QDesktopWebPageProxy(QDesktopWebViewPrivate* desktopWebView, WKContextRef context, WKPageGroupRef pageGroup)
: QtWebPageProxy(desktopWebView, desktopWebView, context, pageGroup)
{
init();
Modified: trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h 2011-08-25 15:13:39 UTC (rev 93784)
@@ -32,7 +32,7 @@
class QDesktopWebPageProxy : public QtWebPageProxy
{
public:
- QDesktopWebPageProxy(QDesktopWebViewPrivate*, QWKContext*, WKPageGroupRef = 0);
+ QDesktopWebPageProxy(QDesktopWebViewPrivate*, WKContextRef, WKPageGroupRef = 0);
virtual bool handleEvent(QEvent*);
Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -27,8 +27,8 @@
using namespace WebCore;
-QTouchWebPageProxy::QTouchWebPageProxy(TouchViewInterface* viewInterface, ViewportInteractionEngine* viewportInteractionEngine, QWKContext* context, WKPageGroupRef pageGroupRef)
- : QtWebPageProxy(viewInterface, 0, context, pageGroupRef)
+QTouchWebPageProxy::QTouchWebPageProxy(TouchViewInterface* viewInterface, ViewportInteractionEngine* viewportInteractionEngine)
+ : QtWebPageProxy(viewInterface, 0)
, m_panGestureRecognizer(viewportInteractionEngine)
, m_pinchGestureRecognizer(viewportInteractionEngine)
{
Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h 2011-08-25 15:13:39 UTC (rev 93784)
@@ -39,7 +39,7 @@
class QTouchWebPageProxy : public QtWebPageProxy
{
public:
- QTouchWebPageProxy(TouchViewInterface*, ViewportInteractionEngine*, QWKContext*, WKPageGroupRef = 0);
+ QTouchWebPageProxy(TouchViewInterface*, ViewportInteractionEngine*);
virtual bool handleEvent(QEvent*);
Deleted: trunk/Source/WebKit2/UIProcess/qt/qwkcontext.cpp (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qwkcontext.cpp 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qwkcontext.cpp 2011-08-25 15:13:39 UTC (rev 93784)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "qwkcontext.h"
-#include "qwkcontext_p.h"
-
-#include "ClientImpl.h"
-#include "IconDatabase.h"
-#include "Image.h"
-#include <QDir>
-#include <QPixmap>
-#include <QUrl>
-#include "WebIconDatabase.h"
-#include "WebPlatformStrategies.h"
-#include "WKIconDatabase.h"
-
-using namespace WebKit;
-
-static inline void initializePlatformStrategiesIfNeeded()
-{
- static bool initialized = false;
- if (initialized)
- return;
-
- WebPlatformStrategies::initialize();
- initialized = true;
-}
-
-QWKContextPrivate::QWKContextPrivate(QWKContext* qq, WebContext* webContext)
- : q(qq)
-{
- if (!webContext)
- context = WebContext::create(String());
- else
- context = webContext;
-
- initializePlatformStrategiesIfNeeded();
-
- WKIconDatabaseClient iconDatabaseClient = {
- 0, // version
- qq, // clientInfo
- qt_wk_didChangeIconForPageURL,
- qt_wk_didRemoveAllIcons
- };
-
- WKIconDatabaseSetIconDatabaseClient(toAPI(context->iconDatabase()), &iconDatabaseClient);
-}
-
-QWKContextPrivate::~QWKContextPrivate()
-{ }
-
-QWKContext::QWKContext(QObject* parent)
- : QObject(parent)
- , d(new QWKContextPrivate(this))
-{ }
-
-QWKContext::QWKContext(WKContextRef contextRef, QObject* parent)
- : QObject(parent)
- , d(new QWKContextPrivate(this, toImpl(contextRef)))
-{ }
-
-QWKContext::~QWKContext()
-{
- delete d;
-}
-
-void QWKContext::setIconDatabasePath(const QString& path)
-{
- // FIXME: There is currently no way to disable the icon database once it's enabled.
- QFileInfo info(path);
- if (info.isDir() && info.isWritable()) {
- QString databasePath = path + QDir::separator() + QString(WebCore::IconDatabase::defaultDatabaseFilename());
- d->context->setIconDatabasePath(databasePath);
- }
-}
-
-QIcon QWKContext::iconForPageURL(const QUrl& pageURL) const
-{
- RefPtr<WebCore::Image> image = d->context->iconDatabase()->imageForPageURL(pageURL.toString());
- if (!image)
- return QIcon();
-
- QPixmap* nativeImage = image->nativeImageForCurrentFrame();
- if (!nativeImage)
- return QIcon();
-
- return QIcon(*nativeImage);
-}
-
-#include "moc_qwkcontext.cpp"
Deleted: trunk/Source/WebKit2/UIProcess/qt/qwkcontext.h (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qwkcontext.h 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qwkcontext.h 2011-08-25 15:13:39 UTC (rev 93784)
@@ -1,52 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef qwkcontext_h
-#define qwkcontext_h
-
-#include "qwebkitglobal.h"
-#include <QObject>
-#include <WebKit2/WKContext.h>
-
-class QIcon;
-class QUrl;
-class QWKContextPrivate;
-
-class QWEBKIT_EXPORT QWKContext : public QObject {
- Q_OBJECT
-public:
- QWKContext(QObject* parent = 0);
- virtual ~QWKContext();
-
- // Bridge from the C API
- QWKContext(WKContextRef contextRef, QObject* parent = 0);
-
- void setIconDatabasePath(const QString&);
- QIcon iconForPageURL(const QUrl&) const;
-
-public:
- Q_SIGNAL void iconChangedForPageURL(const QUrl&);
-
-private:
- QWKContextPrivate* d;
-
- friend class QtWebPageProxy;
-};
-
-#endif /* qwkcontext_h */
Deleted: trunk/Source/WebKit2/UIProcess/qt/qwkcontext_p.h (93783 => 93784)
--- trunk/Source/WebKit2/UIProcess/qt/qwkcontext_p.h 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/UIProcess/qt/qwkcontext_p.h 2011-08-25 15:13:39 UTC (rev 93784)
@@ -1,37 +0,0 @@
-/*
- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-
-#ifndef qwkcontext_p_h
-#define qwkcontext_p_h
-
-#include "WebContext.h"
-#include <wtf/RefPtr.h>
-
-class QWKContextPrivate {
-public:
- QWKContextPrivate(QWKContext*, WebKit::WebContext* = 0);
- ~QWKContextPrivate();
-
- QWKContext* q;
-
- RefPtr<WebKit::WebContext> context;
-};
-
-#endif /* qkcontext_p_h */
Modified: trunk/Source/WebKit2/WebKit2.pro (93783 => 93784)
--- trunk/Source/WebKit2/WebKit2.pro 2011-08-25 14:59:11 UTC (rev 93783)
+++ trunk/Source/WebKit2/WebKit2.pro 2011-08-25 15:13:39 UTC (rev 93784)
@@ -244,8 +244,6 @@
UIProcess/qt/qdesktopwebpageproxy.h \
UIProcess/qt/qtouchwebpageproxy.h \
UIProcess/qt/QtWebPageProxy.h \
- UIProcess/qt/qwkcontext.h \
- UIProcess/qt/qwkcontext_p.h \
UIProcess/qt/qwkhistory.h \
UIProcess/qt/qwkhistory_p.h \
UIProcess/qt/qwkpreferences.h \
@@ -477,7 +475,6 @@
UIProcess/qt/qdesktopwebpageproxy.cpp \
UIProcess/qt/qtouchwebpageproxy.cpp \
UIProcess/qt/QtWebPageProxy.cpp \
- UIProcess/qt/qwkcontext.cpp \
UIProcess/qt/qwkhistory.cpp \
UIProcess/qt/qwkpreferences.cpp \
UIProcess/qt/SGAgent.cpp \