<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [X11] Add XUniquePtr and XUniqueResource to automatically free X resources"
   href="https://bugs.webkit.org/show_bug.cgi?id=144521#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [X11] Add XUniquePtr and XUniqueResource to automatically free X resources"
   href="https://bugs.webkit.org/show_bug.cgi?id=144521">bug 144521</a>
              from <span class="vcard"><a class="email" href="mailto:cgarcia&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=144521#c9">comment #9</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=252487&amp;action=diff" name="attach_252487" title="Try to fix EFL build">attachment 252487</a> <a href="attachment.cgi?id=252487&amp;action=edit" title="Try to fix EFL build">[details]</a></span>
&gt; Try to fix EFL build
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=252487&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=252487&amp;action=review</a></span >

Thanks for the review.

<span class="quote">&gt; &gt; Source/WebCore/PlatformEfl.cmake:200
&gt; &gt; +    platform/graphics/x11/XUnique.cpp
&gt; 
&gt; Consider splitting XUnique.h into XUniquePtr.h and XUniqueResource.h, and
&gt; renaming XUnique.cpp to XUniqueResource.cpp.</span >

Why? I think it's quite simple and reduces the amount of header includes.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/x11/XUnique.h:124
&gt; &gt; +    long unsigned release() { long unsigned resource = m_resource; m_resource = 0; return resource; }
&gt; 
&gt; Use std::exchange() here. (It's C++14, but there's an implementation in
&gt; StdLibExtras.h.)</span >

Cool.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/x11/XUnique.h:126
&gt; &gt; +    void reset(long unsigned resource = 0)
&gt; 
&gt; Instead of `resource.reset()`, I'd prefer resource = nullptr;
&gt; If you consider it, it possible to implement by overloading the assignment
&gt; operator:</span >
&gt;
<span class="quote">&gt;     XUniqueResource&amp; operator=(std::nullptr_t) { ... }</span >

But this resource is not a pointer. I added reset for consistency with std::unique_ptr, and didn't add the assign operator for nullptr, because it doesn't store a pointer.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/x11/XUnique.h:164
&gt; &gt; +typedef XUniqueResource&lt;XResource::Colormap&gt; XUniqueColormap;
&gt; &gt; +#if PLATFORM(GTK)
&gt; &gt; +typedef XUniqueResource&lt;XResource::Damage&gt; XUniqueDamage;
&gt; &gt; +#endif
&gt; &gt; +typedef XUniqueResource&lt;XResource::Pixmap&gt; XUniquePixmap;
&gt; &gt; +typedef XUniqueResource&lt;XResource::Window&gt; XUniqueWindow;
&gt; &gt; +#if USE(GLX)
&gt; &gt; +typedef XUniqueResource&lt;XResource::GLXPbuffer&gt; XUniqueGLXPbuffer;
&gt; &gt; +typedef XUniqueResource&lt;XResource::GLXPixmap&gt; XUniqueGLXPixmap;
&gt; &gt; +#endif
&gt; &gt; +
&gt; &gt; +// Give a name also to these XUniquePtr to avoid having to use the internal struct names (_XGC, __GLXcontextRec, ...).
&gt; &gt; +typedef XUniquePtr&lt;_XGC&gt; XUniqueGC;
&gt; &gt; +#if USE(GLX)
&gt; &gt; +typedef XUniquePtr&lt;__GLXcontextRec&gt; XUniqueGLXContext;
&gt; &gt; +#endif
&gt; 
&gt; Use type aliases:
&gt; using XUniqueWhatever = XUniqueHandler&lt;Whatever&gt;;</span >

Cool!</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>