<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Improve binding of JSBuiltinConstructor classes"
href="https://bugs.webkit.org/show_bug.cgi?id=149556">149556</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Improve binding of JSBuiltinConstructor classes
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>WebCore Misc.
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>youennf@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Following on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Remove the need for DOMClass in case of JSBuiltinConstructor WebIDL"
href="show_bug.cgi?id=149522">bug 149522</a> discussion, we might want to improve the binding generator.
(In reply to <a href="show_bug.cgi?id=149556#c12">comment #12</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=149556#c11">comment #11</a>)
> > (In reply to <a href="show_bug.cgi?id=149556#c4">comment #4</a>)
> > > (In reply to <a href="show_bug.cgi?id=149556#c3">comment #3</a>)
> > > > > Source/WebCore/bindings/js/JSDOMWrapper.h:54
> > > > > + virtual ~DummyDOMClass() { }
> > > >
> > > > Not sure why this is needed. Do we need the class to seem polymorphic for
> > > > some reason?
> > >
> > > This is required by RefCounted IIRC.
> >
> > RefCounted itself definitely does *not* require that the class be
> > polymorphic so it doesn’t require a virtual destructor.
> >
> > We need to make the destructor virtual if we are going to deref or delete
> > these objects in a polymorphic way, using a pointer to a base class. I think
> > you could revisit this and make the class both "final" and not define a
> > virtual destructor.
>
> Thanks for the information.
>
> >
> > You also talked about cleaning things up further so the class isn’t needed
> > at all; if you do that this won’t matter at all.
> >
> > If we do need to keep this class, then we can do another trick for better
> > efficiency:
> >
> > class $className {
> > public:
> > static Ref<$className> create() { return adoptRef(singleton());
> > }\n");
> > static void ref() { }
> > static void deref() { }
> > private:
> > static $className& singleton() { static NeverDestroyed<$className>
> > singleton; return singleton; }
> > };
> >
> > No memory allocation, no incrementing and decrementing reference counts.
>
> Yes, that is one approach I thought of.
> It requires bypassing JSDOMGlobalObject wrapper cache, which is another
> efficiency bonus.
>
> We may also want to use a single singleton for all builtin classes.
>
> To go further, we may want to skip generation of some needless code (toJS,
> releaseImpl...).
>
> Choice may be guided by the added complexity to the binding generator.
> I plan to take some time on this once the JS builtin architecture is ready
> to implement ReadableStream and WritableStream.</span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>