WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
70594
[GTK] Add helper function to set the loader client in WebKitWebView
https://bugs.webkit.org/show_bug.cgi?id=70594
Summary
[GTK] Add helper function to set the loader client in WebKitWebView
Carlos Garcia Campos
Reported
2011-10-21 03:34:22 PDT
It's set in two places, the constructed method and the public method set_loader_client(). In the constructor we don't need to check that view is actually a WebView and loader client is a LoaderClient, and that current client is not the same.
Attachments
Patch
(4.67 KB, patch)
2011-10-21 03:38 PDT
,
Carlos Garcia Campos
mrobinson
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Carlos Garcia Campos
Comment 1
2011-10-21 03:38:12 PDT
Created
attachment 111934
[details]
Patch
Martin Robinson
Comment 2
2011-10-21 07:01:35 PDT
Comment on
attachment 111934
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=111934&action=review
> Source/WebKit2/ChangeLog:5 > + [GTK] Add helper function to set the loader client in WebKitWebView > +
https://bugs.webkit.org/show_bug.cgi?id=70594
> +
These checks are incredibly cheap. Is there some other problem?
> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:68 > - > - webkitWebViewBaseCreateWebPage(WEBKIT_WEB_VIEW_BASE(webView), webkitWebContextGetWKContext(priv->context), 0); > + WebPageProxy* page = webkitWebViewBaseCreateWebPage(WEBKIT_WEB_VIEW_BASE(webView), webkitWebContextGetWKContext(priv->context), 0); >
It seems like instead of doing this manually we should be chaining up to the parent constructor. It's mentioned here that you should always chain up to the parent constructor:
http://developer.gnome.org/gobject/stable/chapter-gobject.html#gobject-instantiation
Carlos Garcia Campos
Comment 3
2011-10-21 08:12:50 PDT
(In reply to
comment #2
)
> (From update of
attachment 111934
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=111934&action=review
> > > Source/WebKit2/ChangeLog:5 > > + [GTK] Add helper function to set the loader client in WebKitWebView > > +
https://bugs.webkit.org/show_bug.cgi?id=70594
> > + > > These checks are incredibly cheap. Is there some other problem?
g_return macros are not so cheap.
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:68 > > - > > - webkitWebViewBaseCreateWebPage(WEBKIT_WEB_VIEW_BASE(webView), webkitWebContextGetWKContext(priv->context), 0); > > + WebPageProxy* page = webkitWebViewBaseCreateWebPage(WEBKIT_WEB_VIEW_BASE(webView), webkitWebContextGetWKContext(priv->context), 0); > > > > It seems like instead of doing this manually we should be chaining up to the parent constructor. It's mentioned here that you should always chain up to the parent constructor:
http://developer.gnome.org/gobject/stable/chapter-gobject.html#gobject-instantiation
This method is constructed, not constructor.
Martin Robinson
Comment 4
2011-10-21 09:21:05 PDT
Comment on
attachment 111934
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=111934&action=review
Okay. Looks fine, but I have a minor change requested below. Thank for cleaning this up.
> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:60 > + webView->priv->loaderClient = loaderClient; > + webkitWebLoaderClientAttachLoaderClientToPage(loaderClient, wkPage);
Instead of passing the page as an argument, I think it'd be better to get it here with: WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView));
>>> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:68 >>> >> >> It seems like instead of doing this manually we should be chaining up to the parent constructor. It's mentioned here that you should always chain up to the parent constructor:
http://developer.gnome.org/gobject/stable/chapter-gobject.html#gobject-instantiation
> > This method is constructed, not constructor.
Still the docs suggest chaining up: "the constructed function is called by g_object_new() as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. constructed implementors should chain up to the constructed call of their parent class to allow it to complete its initialisation."
> Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:439 > -void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WKContextRef context, WKPageGroupRef pageGroup) > +WebPageProxy* webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WKContextRef context, WKPageGroupRef pageGroup) > { > WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv; >
I dislike this change because we ignore the return value in WebKitWebViewBase. Do you mind just getting the Page in WebKitWebViewSetLoader client?
Carlos Garcia Campos
Comment 5
2011-10-24 08:16:35 PDT
Committed
r98241
: <
http://trac.webkit.org/changeset/98241
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug