Closed Bug 1218488 Opened 9 years ago Closed 9 years ago

clarify buffer ownership for nsICanvasRenderingContextInternal::GetBuffer

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

This patch started life as making ImageEncoder.cpp:EncodingRunnable not
use nsAutoArrayPtr, but the API effects rippled out from there.  On the
whole, I think using UniquePtr throughout has made the code clearer.
Bas for the gfx/ parts (and the Windows widget parts, if he feels comfortable
with them), baku for the dom/ parts.
Attachment #8679014 - Flags: review?(bas)
Attachment #8679014 - Flags: review?(amarchesini)
Comment on attachment 8679014 [details] [diff] [review]
clarify buffer ownership for nsICanvasRenderingContextInternal::GetBuffer

Review of attachment 8679014 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/canvas/CanvasRenderingContextHelper.cpp
@@ +49,5 @@
>        return;
>      }
>    }
>  
> +  UniquePtr<uint8_t[]> imageBuffer = nullptr;

remove '= nullptr'

::: dom/canvas/WebGLContext.cpp
@@ +1061,5 @@
>      bool premult;
>      RefPtr<SourceSurface> snapshot =
>        GetSurfaceSnapshot(mOptions.premultipliedAlpha ? nullptr : &premult);
>      if (!snapshot)
> +        return nullptr;

if (!snapshot) {
  return;
}
Attachment #8679014 - Flags: review?(amarchesini) → review+
Comment on attachment 8679014 [details] [diff] [review]
clarify buffer ownership for nsICanvasRenderingContextInternal::GetBuffer

Review of attachment 8679014 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/canvas/WebGLContext.cpp
@@ +1061,5 @@
>      bool premult;
>      RefPtr<SourceSurface> snapshot =
>        GetSurfaceSnapshot(mOptions.premultipliedAlpha ? nullptr : &premult);
>      if (!snapshot)
> +        return nullptr;

Wait.. what? You can't return nothing from this function.. can you?
Attachment #8679014 - Flags: review?(bas) → review+
https://hg.mozilla.org/mozilla-central/rev/53952bbfad9a
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: