RESOLVED FIXED127170
[GTK] Add GUniquePtr
https://bugs.webkit.org/show_bug.cgi?id=127170
Summary [GTK] Add GUniquePtr
Carlos Garcia Campos
Reported 2014-01-17 03:59:04 PST
The idea is to replace GOwnPtr with a new simpler class derived the std:unique_ptr. Not everything can be replaced, though, because GOwnPtr::outPtr() doesn't seem to be possible to implement with unique_ptr.
Attachments
Patch (8.69 KB, patch)
2014-01-17 04:07 PST, Carlos Garcia Campos
no flags
Updated patch (8.72 KB, patch)
2014-01-17 04:55 PST, Carlos Garcia Campos
no flags
Updated patch (9.37 KB, patch)
2014-01-17 04:59 PST, Carlos Garcia Campos
no flags
Updated patch (9.38 KB, patch)
2014-01-17 06:06 PST, Carlos Garcia Campos
no flags
Even simpler patch using template alias (9.19 KB, patch)
2014-01-17 08:53 PST, Carlos Garcia Campos
no flags
Updated patch (9.67 KB, patch)
2014-01-21 09:26 PST, Carlos Garcia Campos
gustavo: review+
Carlos Garcia Campos
Comment 1 2014-01-17 04:07:07 PST
Created attachment 221454 [details] Patch This is a first patch adding support for glib types already supported by GOwnPtr, except GError that is usually used with GOwnPtr::outPtr(). Then, adding support for Soup and GTK/GDK types would be a matter of defining a macro FOR_EACH_SOUP_DELETER, FOR_EACH_GDK_DELETER, etc and call it with DEFINE_DELETER. I'll also start porting existing code to GUniquePtr once/if this patch lands.
Carlos Garcia Campos
Comment 2 2014-01-17 04:55:50 PST
Created attachment 221457 [details] Updated patch Undef the FOR_EACH_GLIB_DELETER after using it.
Carlos Garcia Campos
Comment 3 2014-01-17 04:59:13 PST
Created attachment 221458 [details] Updated patch Forgot to git add the tests makefile changes.
Carlos Garcia Campos
Comment 4 2014-01-17 06:06:04 PST
Created attachment 221461 [details] Updated patch Simply made the operator() of the deleters const.
Carlos Garcia Campos
Comment 5 2014-01-17 08:53:39 PST
Created attachment 221470 [details] Even simpler patch using template alias This is even simpler now using a template alias as suggested in bug #126255
Carlos Garcia Campos
Comment 6 2014-01-21 09:26:00 PST
Created attachment 221754 [details] Updated patch Added deleter for GError and prefixed the DEFINE_DELETER macro with WTF since it's public macro to be used by others.
Gustavo Noronha (kov)
Comment 7 2014-01-21 09:58:57 PST
Comment on attachment 221754 [details] Updated patch LGTM, pitty we can't extend std::unique_ptr, but then again, not sure how sane that would be.
Carlos Garcia Campos
Comment 8 2014-01-22 05:59:06 PST
Zan Dobersek
Comment 9 2014-01-24 02:33:17 PST
*** Bug 126255 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.