WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
94315
[GTK] Add destroy notify for register_uri_scheme
https://bugs.webkit.org/show_bug.cgi?id=94315
Summary
[GTK] Add destroy notify for register_uri_scheme
Jesse van den Kieboom
Reported
2012-08-17 01:59:55 PDT
For introspection to work correctly, a destroy notify needs to be added to register_uri_scheme so that bindings know when to finalize the userdata. I've added a patch which adds the destroy notify and calls it when the uri handler is finalized. I really don't know much about webkit so it might well be that this doesn't work correctly (I don't know if those objects in HashMap get copied or not), but it's a start :)
Attachments
Add destroy notify
(5.58 KB, patch)
2012-08-17 02:02 PDT
,
Jesse van den Kieboom
cgarcia
: review-
Details
Formatted Diff
Diff
Updated patch
(7.41 KB, patch)
2012-08-21 03:37 PDT
,
Carlos Garcia Campos
pnormand
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Jesse van den Kieboom
Comment 1
2012-08-17 02:02:11 PDT
Created
attachment 159050
[details]
Add destroy notify
Carlos Garcia Campos
Comment 2
2012-08-17 02:53:37 PDT
Comment on
attachment 159050
[details]
Add destroy notify View in context:
https://bugs.webkit.org/attachment.cgi?id=159050&action=review
Thank you very much for the patch. Please read this
http://www.webkit.org/coding/contributing.html
Patches should include a ChangeLog and you should set the r flag to ? to ask for a review.
> Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp:68 > + if (destroyNotify) > + { > + destroyNotify(userData); > + }
Don't see use braces for one-line ifs, see
http://www.webkit.org/coding/coding-style.html
> Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp:394 > + * @destroy_notify: destroy notify for @user_data
I prefer to call this something like user_data_destroy_func
> Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp:568 > - WebKitURISchemeHandler handler = context->priv->uriSchemeHandlers.get(webkit_uri_scheme_request_get_scheme(request)); > + WebKitURISchemeHandler const &handler = context->priv->uriSchemeHandlers.get(webkit_uri_scheme_request_get_scheme(request));
Unfortunately this is not enough, when the handler is set to the HashMap it's also copied, so the destructor will be called in that case too. So, we have several options here: a) Make WebKitURISchemeHandler a refcounted class instead of a struct. b) Ierate all handlers in webkitWebContextFinalize to call destroy_notify function probably a) is easier, you need to convert it into a class deriving from RefCounted class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> { and then change the HashMap definition to: typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap;
> Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:165 > - webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this); > + webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this, 0);
Ideally the destroy notify should also be tested in the unit tests, but in this case it's not so easy, because the web context is destroyed when all tests have finished.
Carlos Garcia Campos
Comment 3
2012-08-20 06:34:31 PDT
Jesse, are you working on a new patch for this? Since it's an api change I would like to land this patch before the release.
Carlos Garcia Campos
Comment 4
2012-08-21 03:37:16 PDT
Created
attachment 159644
[details]
Updated patch
WebKit Review Bot
Comment 5
2012-08-21 03:40:03 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See
http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Philippe Normand
Comment 6
2012-08-21 03:53:02 PDT
Comment on
attachment 159644
[details]
Updated patch LGTM
Philippe Normand
Comment 7
2012-08-21 03:54:36 PDT
Comment on
attachment 159644
[details]
Updated patch View in context:
https://bugs.webkit.org/attachment.cgi?id=159644&action=review
> Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:168 > - webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this); > + webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this, 0);
I think Carlos wanted to have the test checking the destroy notify callback.
Carlos Garcia Campos
Comment 8
2012-08-21 03:56:45 PDT
(In reply to
comment #7
)
> (From update of
attachment 159644
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=159644&action=review
> > > Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebContext.cpp:168 > > - webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this); > > + webkit_web_context_register_uri_scheme(webkit_web_context_get_default(), scheme, uriSchemeRequestCallback, this, 0); > > I think Carlos wanted to have the test checking the destroy notify callback.
Yes, but unfortunately it's not possible: "Ideally the destroy notify should also be tested in the unit tests, but in this case it's not so easy, because the web context is destroyed when all tests have finished."
Philippe Normand
Comment 9
2012-08-21 04:10:41 PDT
Comment on
attachment 159644
[details]
Updated patch Please wait EWS before landing :)
Carlos Garcia Campos
Comment 10
2012-08-21 04:13:29 PDT
(In reply to
comment #9
)
> (From update of
attachment 159644
[details]
) > Please wait EWS before landing :)
Sure, thanks reviewing!
Carlos Garcia Campos
Comment 11
2012-08-21 05:50:45 PDT
Committed
r126152
: <
http://trac.webkit.org/changeset/126152
>
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