2010-12-11 Yi Shen <yi.4.shen@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] Memory leaks for QWebPageClient
        https://bugs.webkit.org/show_bug.cgi?id=50267

        Use OwnPtr to solve this memory leak issue.

        * Api/qgraphicswebview.cpp:
        (QGraphicsWebViewPrivate::overlay):
        (QGraphicsWebViewPrivate::QWebViewPrivate::pageClient):
        (QGraphicsWebViewPrivate::syncLayers):
        (QGraphicsWebViewPrivate::updateResizesToContentsForPage):
        (QGraphicsWebViewPrivate::_q_scaleChanged):
        (QGraphicsWebViewPrivate::detachCurrentPage):
        * Api/qwebpage_p.h:
        * Api/qwebview.cpp:
        (QWebViewPrivate::detachCurrentPage):
        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::platformPageClient):
        * WebCoreSupport/EditorClientQt.cpp:
        (WebCore::EditorClientQt::setInputMethodState):
        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::createPlugin):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73867 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ae6c34f4
......@@ -80,8 +80,13 @@ public:
{
if (!page || !page->d->client)
return 0;
return static_cast<PageClientQGraphicsWidget*>(page->d->client)->overlay;
return pageClient()->overlay;
}
PageClientQGraphicsWidget* pageClient() const
{
return static_cast<WebCore::PageClientQGraphicsWidget*> (page->d->client.get());
}
};
QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
......@@ -92,7 +97,7 @@ QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate()
void QGraphicsWebViewPrivate::syncLayers()
{
#if USE(ACCELERATED_COMPOSITING)
static_cast<PageClientQGraphicsWidget*>(page->d->client)->syncLayers();
pageClient()->syncLayers();
#endif
}
......@@ -128,7 +133,7 @@ void QGraphicsWebViewPrivate::_q_pageDestroyed()
void QGraphicsWebViewPrivate::updateResizesToContentsForPage()
{
ASSERT(page);
static_cast<PageClientQGraphicsWidget*>(page->d->client)->viewResizesToContents = resizesToContents;
pageClient()->viewResizesToContents = resizesToContents;
if (resizesToContents) {
// resizes to contents mode requires preferred contents size to be set
if (!page->preferredContentsSize().isValid())
......@@ -156,7 +161,7 @@ void QGraphicsWebViewPrivate::_q_scaleChanged()
#if ENABLE(TILED_BACKING_STORE)
if (!page)
return;
static_cast<PageClientQGraphicsWidget*>(page->d->client)->updateTiledBackingStoreScale();
pageClient()->updateTiledBackingStoreScale();
#endif
}
......@@ -414,9 +419,6 @@ void QGraphicsWebViewPrivate::detachCurrentPage()
return;
page->d->view.clear();
// The client has always to be deleted.
delete page->d->client;
page->d->client = 0;
// if the page was created by us, we own it and need to
......
......@@ -2008,7 +2008,7 @@ void QWebPage::setView(QWidget* view)
if (d->client) {
if (d->client->isQWidgetClient())
static_cast<PageClientQWidget*>(d->client)->view = view;
static_cast<PageClientQWidget*>(d->client.get())->view = view;
return;
}
......
......@@ -35,6 +35,7 @@
#include "KURL.h"
#include "PlatformString.h"
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
#include "ViewportArguments.h"
......@@ -160,7 +161,7 @@ public:
QWebPage *q;
WebCore::Page *page;
QWebPageClient* client;
OwnPtr<QWebPageClient> client;
QPointer<QWebFrame> mainFrame;
#ifndef QT_NO_UNDOSTACK
......
......@@ -353,9 +353,9 @@ void QWebViewPrivate::detachCurrentPage()
// to destroy it.
if (page->d->client && page->d->client->isQWidgetClient())
delete page->d->client;
page->d->client.clear();
page->d->client = 0;
page->d->client.release();
// if the page was created by us, we own it and need to
// destroy it as well.
......
2010-12-11 Yi Shen <yi.4.shen@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Memory leaks for QWebPageClient
https://bugs.webkit.org/show_bug.cgi?id=50267
Use OwnPtr to solve this memory leak issue.
* Api/qgraphicswebview.cpp:
(QGraphicsWebViewPrivate::overlay):
(QGraphicsWebViewPrivate::QWebViewPrivate::pageClient):
(QGraphicsWebViewPrivate::syncLayers):
(QGraphicsWebViewPrivate::updateResizesToContentsForPage):
(QGraphicsWebViewPrivate::_q_scaleChanged):
(QGraphicsWebViewPrivate::detachCurrentPage):
* Api/qwebpage_p.h:
* Api/qwebview.cpp:
(QWebViewPrivate::detachCurrentPage):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::platformPageClient):
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::setInputMethodState):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::createPlugin):
2010-12-11 Jan Erik Hanssen <jhanssen@sencha.com>
Reviewed by Andreas Kling.
......
......@@ -74,6 +74,7 @@
#include <qeventloop.h>
#include <qtextdocument.h>
#include <qtooltip.h>
#include <wtf/OwnPtr.h>
namespace WebCore {
......@@ -453,7 +454,7 @@ IntPoint ChromeClientQt::screenToWindow(const IntPoint& point) const
PlatformPageClient ChromeClientQt::platformPageClient() const
{
return m_webPage->d->client;
return m_webPage->d->client.get();
}
void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const
......
......@@ -53,6 +53,7 @@
#include <QUndoStack>
#include <stdio.h>
#include <wtf/OwnPtr.h>
#define methodDebug() qDebug("EditorClientQt: %s", __FUNCTION__);
......@@ -574,7 +575,7 @@ void EditorClientQt::willSetInputMethodState()
void EditorClientQt::setInputMethodState(bool active)
{
QWebPageClient* webPageClient = m_page->d->client;
QWebPageClient* webPageClient = m_page->d->client.get();
if (webPageClient) {
Qt::InputMethodHints hints;
......
......@@ -86,6 +86,7 @@
#include <QNetworkReply>
#include <QStringList>
#include "qwebhistory_p.h"
#include <wtf/OwnPtr.h>
static QMap<unsigned long, QString> dumpAssignedUrls;
......@@ -1536,7 +1537,7 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
Vector<String> values = paramValues;
#if !OS(SYMBIAN)
if (mimeType == "application/x-shockwave-flash") {
QWebPageClient* client = m_webFrame->page()->d->client;
QWebPageClient* client = m_webFrame->page()->d->client.get();
const bool isQWebView = client && qobject_cast<QWidget*>(client->pluginParent());
#if defined(MOZ_PLATFORM_MAEMO) && (MOZ_PLATFORM_MAEMO >= 5)
size_t wmodeIndex = params.find("wmode");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment