[WebKit-devel] (K)WebView initialization change proposal

Urs Wolfer uwolfer at kde.org
Tue May 5 22:08:15 CEST 2009


On Tuesday 05 May 2009 18:23:29 Paweł Prażak wrote:
> Hi!
>
> I found that in KWebView's and WebView's constructors we create
> (K)WebPage object and set it, so if we create new WebView we create
> and immediately destroy a KWebPage object (in KWebView's constructor)
> and than we create WebPage object.
>
> I propose to eliminate this unnecessary object and to make WebPage
> creation lazy. This way, we will have less overhead in constructor and
> the KWebView::page() will never return a null pointer.
>
> The WebPage would be created on demand if needed (in page() method).
>
> About the KWebView::page(), something weird happens there, but the
> problem is not so obvious on the first sight. We call QWebView::page()
> to determine if we already have one, the problem is that
> QWebView::page() creates new QWebPage if needed (if d->page is null),
> so we create new QWebPage just to maka qobject_cast<KWebPage *> and
> find out that its not a KWebPage.
>
> Please take a look at attached patch with proposed implementation for
> details.
>
> I look forward to your comments :)

Hi Paweł

Your idea makes sense to me. What I don't like is QWebView#page, which is not 
virtual. Though that was also an issue before.

So +1 from my side.

Btw, I have also seen your final patch for the reformating. I will look into 
it and commit ASAP.

Thanks for your work.

Bye
urs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/webkit-devel/attachments/20090505/c87d754a/attachment.sig 


More information about the WebKit-devel mailing list