RESOLVED FIXED Bug 112782
[WK2] Remove repeating code in declaration of WK2 API classes
https://bugs.webkit.org/show_bug.cgi?id=112782
Summary [WK2] Remove repeating code in declaration of WK2 API classes
Mikhail Pozdnyakov
Reported 2013-03-20 01:19:49 PDT
The following two lines of code are repeated in every class inheriting WebKit::APIObject. 1) static const Type APIType = SomeAPIType; 2) virtual Type type() const { return APIType; } This code copy/paste could be avoided.
Attachments
WIP patch (2.33 KB, patch)
2013-03-20 01:54 PDT, Mikhail Pozdnyakov
eflews.bot: commit-queue-
patch (83.57 KB, patch)
2013-03-21 08:36 PDT, Mikhail Pozdnyakov
no flags
Mikhail Pozdnyakov
Comment 1 2013-03-20 01:54:20 PDT
Created attachment 194002 [details] WIP patch This proposal patch introduces template class template <APIObject::Type ArgumentType> class TypedAPIObject : public APIObject which contains the common functionality.
EFL EWS Bot
Comment 2 2013-03-20 02:16:38 PDT
Mikhail Pozdnyakov
Comment 3 2013-03-20 02:25:53 PDT
Comment on attachment 194002 [details] WIP patch View in context: https://bugs.webkit.org/attachment.cgi?id=194002&action=review > Source/WebKit2/UIProcess/efl/WebPopupItemEfl.h:35 > +class WebPopupItemEfl : TypedAPIObject<APIObject::TypePopupMenuItem> { argh, missed 'public' here :(
Benjamin Poulain
Comment 4 2013-03-20 14:23:41 PDT
Comment on attachment 194002 [details] WIP patch View in context: https://bugs.webkit.org/attachment.cgi?id=194002&action=review This looks like a great idea but if you plan to only fix the ELF types, I am gonna stab you :) > Source/WebKit2/Shared/APIObject.h:165 > + virtual Type type() const { return APIType; } Shouldn't it be private?
Mikhail Pozdnyakov
Comment 5 2013-03-21 06:33:35 PDT
(In reply to comment #4) > (From update of attachment 194002 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=194002&action=review > > This looks like a great idea but if you plan to only fix the ELF types, I am gonna stab you :) > No no, it was just an illustration patch, I am planning to deploy it to every object :) > > Source/WebKit2/Shared/APIObject.h:165 > > + virtual Type type() const { return APIType; } > > Shouldn't it be private? It could, but this would mean that the object cannot invoke it's own type() method, so would keep it protected.
Mikhail Pozdnyakov
Comment 6 2013-03-21 08:36:49 PDT
Benjamin Poulain
Comment 7 2013-03-25 14:27:37 PDT
Comment on attachment 194269 [details] patch Great change! Can you deploy it to all APIObject? (WebFrameListenerProxy's subclass as you mentioned on IRC)
Mikhail Pozdnyakov
Comment 8 2013-03-26 02:13:44 PDT
(In reply to comment #7) > (From update of attachment 194269 [details]) > Great change! > Can you deploy it to all APIObject? (WebFrameListenerProxy's subclass as you mentioned on IRC) Unfortunately it's not that easy to deploy to WebFrameListenerProxy's subclasses because WebFrameProxy contains RefPtr<WebFrameListenerProxy> m_activeListener; hence WebFrameListenerProxy has to inherit ThreadSafeRefCounted directly. The only solution that I see is virtual inheritance, would you like it?
Benjamin Poulain
Comment 9 2013-03-26 18:00:15 PDT
Comment on attachment 194269 [details] patch > Unfortunately it's not that easy to deploy to WebFrameListenerProxy's subclasses because WebFrameProxy contains RefPtr<WebFrameListenerProxy> m_activeListener; hence WebFrameListenerProxy has to inherit ThreadSafeRefCounted directly. > The only solution that I see is virtual inheritance, would you like it? Nope, screw that :)
WebKit Review Bot
Comment 10 2013-04-02 01:31:13 PDT
Comment on attachment 194269 [details] patch Clearing flags on attachment: 194269 Committed r147403: <http://trac.webkit.org/changeset/147403>
WebKit Review Bot
Comment 11 2013-04-02 01:31:17 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.