<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@apple.com" title="Beth Dakin <bdakin@apple.com>"> <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">> Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=262453&action=diff" name="attach_262453" title="Patch">attachment 262453</a> <a href="attachment.cgi?id=262453&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=262453&action=review">https://bugs.webkit.org/attachment.cgi?id=262453&action=review</a>
>
> > Source/WebCore/platform/graphics/cocoa/IOSurface.h:39
> > +enum class PixelFormatForColor {
>
> I don't think we need the "ForColor" here, and I think maybe this should be
> inside WebCore::IOSurface? Maybe WebCore::IOSurface::Format?
> </span >
Fixed! I went with your suggestion.
<span class="quote">> > Source/WebCore/platform/graphics/cocoa/IOSurface.h:42
> > + YUVCompressed
>
> I don't think we need "compressed" here. I think this should be more
> specific, too: YUV422, or something like that.
> </span >
Fixed! I again went with your suggestion.
<span class="quote">> > Source/WebCore/platform/graphics/cocoa/IOSurface.h:91
> > + WEBCORE_EXPORT void convertToFormat(PixelFormatForColor, std::function<void(std::unique_ptr<WebCore::IOSurface>)>);
>
> This should probably be a class method that takes a move-only
> WebCore::IOSurface, so that it's clear that it consumes the surface.
> Otherwise someone could accidentally keep using the now dead surface.
> Something like this:
>
> WEBCORE_EXPORT static void
> convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface,
> PixelFormatForColor,
> std::function<void(std::unique_ptr<WebCore::IOSurface>)>);
> </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">> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:264
> > + static IOSurfaceAcceleratorRef accelerator;
> > + if (!accelerator) {
> > + IOSurfaceAcceleratorCreate(nullptr, nullptr, &accelerator);
> > +
> > + auto runLoopSource = IOSurfaceAcceleratorGetRunLoopSource(accelerator);
> > + CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, kCFRunLoopDefaultMode);
> > + }
>
> We should check with the appropriate folks that it's OK to keep one of these
> alive forever. I'm not sure.
> </span >
Okay…Will follow up on this.
<span class="quote">> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:266
> > + auto destinationSurface = IOSurface::create(m_size, m_colorSpace, pixelFormat);
>
> We should bail (call the callback synchronously with the current surface) if
> the pixel formats are the same.
>
> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:274
> > +
>
> no newline here
> </span >
Fixed!
<span class="quote">> > Source/WebCore/platform/graphics/cocoa/IOSurface.mm:282
> > + IOSurfaceAcceleratorTransformSurface(accelerator, m_surface.get(), destinationIOSurfaceRef, nullptr, nullptr, &completion, nullptr, nullptr);
>
> Please retrieve the IOReturn from this and from IOSurfaceAcceleratorCreate
> 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>