<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Compress snapshots on iOS"
   href="https://bugs.webkit.org/show_bug.cgi?id=149814#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Compress snapshots on iOS"
   href="https://bugs.webkit.org/show_bug.cgi?id=149814">bug 149814</a>
              from <span class="vcard"><a class="email" href="mailto:bdakin&#64;apple.com" title="Beth Dakin &lt;bdakin&#64;apple.com&gt;"> <span class="fn">Beth Dakin</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=149814#c4">comment #4</a>)
<span class="quote">&gt; Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=262453&amp;action=diff" name="attach_262453" title="Patch">attachment 262453</a> <a href="attachment.cgi?id=262453&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=262453&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=262453&amp;action=review</a>
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.h:39
&gt; &gt; +enum class PixelFormatForColor {
&gt; 
&gt; I don't think we need the &quot;ForColor&quot; here, and I think maybe this should be
&gt; inside WebCore::IOSurface? Maybe WebCore::IOSurface::Format?
&gt; </span >

Fixed! I went with your suggestion.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.h:42
&gt; &gt; +    YUVCompressed
&gt; 
&gt; I don't think we need &quot;compressed&quot; here. I think this should be more
&gt; specific, too: YUV422, or something like that.
&gt; </span >

Fixed! I again went with your suggestion.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.h:91
&gt; &gt; +    WEBCORE_EXPORT void convertToFormat(PixelFormatForColor, std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt;);
&gt; 
&gt; This should probably be a class method that takes a move-only
&gt; WebCore::IOSurface, so that it's clear that it consumes the surface.
&gt; Otherwise someone could accidentally keep using the now dead surface.
&gt; Something like this:
&gt; 
&gt; WEBCORE_EXPORT static void
&gt; convertToFormat(std::unique_ptr&lt;WebCore::IOSurface&gt;&amp;&amp; inSurface,
&gt; PixelFormatForColor,
&gt; std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt;);
&gt; </span >

Fixed! Should I move it to the top of the file? It doesn't really matter, but I feel like that is where class methods go.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.mm:264
&gt; &gt; +    static IOSurfaceAcceleratorRef accelerator;
&gt; &gt; +    if (!accelerator) {
&gt; &gt; +        IOSurfaceAcceleratorCreate(nullptr, nullptr, &amp;accelerator);
&gt; &gt; +
&gt; &gt; +        auto runLoopSource = IOSurfaceAcceleratorGetRunLoopSource(accelerator);
&gt; &gt; +        CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, kCFRunLoopDefaultMode);
&gt; &gt; +    }
&gt; 
&gt; We should check with the appropriate folks that it's OK to keep one of these
&gt; alive forever. I'm not sure.
&gt; </span >

Okay…Will follow up on this.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.mm:266
&gt; &gt; +    auto destinationSurface = IOSurface::create(m_size, m_colorSpace, pixelFormat);
&gt; 
&gt; We should bail (call the callback synchronously with the current surface) if
&gt; the pixel formats are the same.
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.mm:274
&gt; &gt; +
&gt; 
&gt; no newline here
&gt; </span >

Fixed!

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/cocoa/IOSurface.mm:282
&gt; &gt; +    IOSurfaceAcceleratorTransformSurface(accelerator, m_surface.get(), destinationIOSurfaceRef, nullptr, nullptr, &amp;completion, nullptr, nullptr);
&gt; 
&gt; Please retrieve the IOReturn from this and from IOSurfaceAcceleratorCreate
&gt; and ASSERT_UNUSED(ret, ret == kIOReturnSuccess); like we do in other places.</span >


Fixed!

Thanks Tim!</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>