RESOLVED FIXED 141813
[WK2][GTK] Fix the build after r180362
https://bugs.webkit.org/show_bug.cgi?id=141813
Summary [WK2][GTK] Fix the build after r180362
Csaba Osztrogonác
Reported 2015-02-19 14:06:04 PST
SSIA. I won't be online until monday morning, feel free to pick it up.
Attachments
Hot Fix (1.89 KB, patch)
2015-02-20 00:22 PST, Gyuyoung Kim
no flags
Patch (1.84 KB, patch)
2015-02-20 00:24 PST, Hunseop Jeong
gyuyoung.kim: review-
Fix (3.81 KB, patch)
2015-02-20 01:32 PST, Carlos Garcia Campos
zan: review+
Gyuyoung Kim
Comment 1 2015-02-20 00:22:40 PST
Gyuyoung Kim
Comment 2 2015-02-20 00:24:39 PST
I don't find what is correct fix against r180362. However if we don't use API::Object::wrap | API::Object::unwrap, EFL and GTK ports are fine at the moment.
Hunseop Jeong
Comment 3 2015-02-20 00:24:51 PST
Gyuyoung Kim
Comment 4 2015-02-20 00:27:32 PST
Comment on attachment 246943 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=246943&action=review > Source/WebKit2/Shared/API/c/WKSharedAPICast.h:131 > +#if PLATFORM(COCOA) I'm not sure whether r180362 was only related with COCOA platform. I think my previous patch looks better.
Carlos Garcia Campos
Comment 5 2015-02-20 00:29:12 PST
I'm not sure this is the correct fix. wrap/unwrapp are defined in cross-platform code and there's an implementation using static casts when !DELEGATE_REF_COUNTING_TO_COCOA
Gyuyoung Kim
Comment 6 2015-02-20 00:30:37 PST
(In reply to comment #5) > I'm not sure this is the correct fix. wrap/unwrapp are defined in > cross-platform code and there's an implementation using static casts when > !DELEGATE_REF_COUNTING_TO_COCOA Yes, that's why I just uploaded a hot fix. I'm still looking this.
Carlos Garcia Campos
Comment 7 2015-02-20 01:32:17 PST
Created attachment 246945 [details] Fix This fixes the build fot GTK+ let's see what happens with EFL
WebKit Commit Bot
Comment 8 2015-02-20 01:34:44 PST
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
Carlos Garcia Campos
Comment 9 2015-02-20 01:54:33 PST
Since fixes a different between ports, and I don't know how to fix the EFL build, I think it would be better to use different bugs.
Gyuyoung Kim
Comment 10 2015-02-20 01:55:39 PST
(In reply to comment #9) > Since fixes a different between ports, and I don't know how to fix the EFL > build, I think it would be better to use different bugs. Ok, I'm going to file a new bug for EFL port.
Zan Dobersek
Comment 11 2015-02-20 02:59:50 PST
Comment on attachment 246945 [details] Fix View in context: https://bugs.webkit.org/attachment.cgi?id=246945&action=review > Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h:48 > +inline WKViewRef toAPI(WebKitWebViewBase* view) > +{ > + return static_cast<WKViewRef>(static_cast<void*>(view)); > +} > + > +inline WebKitWebViewBase* toImpl(WKViewRef view) > +{ > + return static_cast<WebKitWebViewBase*>(static_cast<void*>(const_cast<OpaqueWKView*>(view))); > +} These should be specializations of the respective templates. They should also mimic the previous behavior of the generic toAPI<>() and toImpl<>() templates. But ideally you'd have WebKitWebViewBase somehow inherit from API::Object, if that's even possible. I ended up with this, built with Clang but not tested: > template<> > inline WKViewRef toAPI<>(WebKitWebViewBase* view) > { > return reinterpret_cast<WKViewRef>(static_cast<void*>(view)); > } > > template<> > inline WebKitWebViewBase* toImpl<>(WKViewRef view) > { > return static_cast<WebKitWebViewBase*>(static_cast<void*>(const_cast<typename std::remove_const<typename std::remove_pointer<WKViewRef>::type>::type*>(view))); > }
Carlos Garcia Campos
Comment 12 2015-02-20 03:07:28 PST
(In reply to comment #11) > Comment on attachment 246945 [details] > Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=246945&action=review > > > Source/WebKit2/UIProcess/API/C/gtk/WKAPICastGtk.h:48 > > +inline WKViewRef toAPI(WebKitWebViewBase* view) > > +{ > > + return static_cast<WKViewRef>(static_cast<void*>(view)); > > +} > > + > > +inline WebKitWebViewBase* toImpl(WKViewRef view) > > +{ > > + return static_cast<WebKitWebViewBase*>(static_cast<void*>(const_cast<OpaqueWKView*>(view))); > > +} > > These should be specializations of the respective templates. They should > also mimic the previous behavior of the generic toAPI<>() and toImpl<>() > templates. > But ideally you'd have WebKitWebViewBase somehow inherit from API::Object, > if that's even possible. > > I ended up with this, built with Clang but not tested: > > > template<> > > inline WKViewRef toAPI<>(WebKitWebViewBase* view) > > { > > return reinterpret_cast<WKViewRef>(static_cast<void*>(view)); > > } > > > > template<> > > inline WebKitWebViewBase* toImpl<>(WKViewRef view) > > { > > return static_cast<WebKitWebViewBase*>(static_cast<void*>(const_cast<typename std::remove_const<typename std::remove_pointer<WKViewRef>::type>::type*>(view))); > > } That works here.
Carlos Garcia Campos
Comment 13 2015-02-20 03:16:35 PST
Anders Carlsson
Comment 14 2015-02-23 14:51:34 PST
> > I ended up with this, built with Clang but not tested: > > > > > template<> > > > inline WKViewRef toAPI<>(WebKitWebViewBase* view) > > > { > > > return reinterpret_cast<WKViewRef>(static_cast<void*>(view)); > > > } > > > > > > template<> > > > inline WebKitWebViewBase* toImpl<>(WKViewRef view) > > > { > > > return static_cast<WebKitWebViewBase*>(static_cast<void*>(const_cast<typename std::remove_const<typename std::remove_pointer<WKViewRef>::type>::type*>(view))); > > > } > > That works here. Why didn't you add traits instead?
Carlos Garcia Campos
Comment 15 2015-02-23 23:32:24 PST
(In reply to comment #14) > > > I ended up with this, built with Clang but not tested: > > > > > > > template<> > > > > inline WKViewRef toAPI<>(WebKitWebViewBase* view) > > > > { > > > > return reinterpret_cast<WKViewRef>(static_cast<void*>(view)); > > > > } > > > > > > > > template<> > > > > inline WebKitWebViewBase* toImpl<>(WKViewRef view) > > > > { > > > > return static_cast<WebKitWebViewBase*>(static_cast<void*>(const_cast<typename std::remove_const<typename std::remove_pointer<WKViewRef>::type>::type*>(view))); > > > > } > > > > That works here. > > Why didn't you add traits instead? Where? Could you elaborate a bit more? The thing is WebKitWebViewBase is not an API::Object, because it's not even a C++ class, but a GObject, so adding toAPI/toImpl for it was the only way I knew how to fix the problem. If there's a better way, I'll land a follow up patch.
Note You need to log in before you can comment on or make changes to this bug.