RESOLVED FIXED Bug 59849
Avoid allocating a new image buffer in ~CanvasRenderingContext2D()
https://bugs.webkit.org/show_bug.cgi?id=59849
Summary Avoid allocating a new image buffer in ~CanvasRenderingContext2D()
Simon Fraser (smfr)
Reported 2011-04-29 17:35:21 PDT
The code I added to ~CanvasRenderingContext2D() to unwind the graphics stack can end up allocating a new image buffer, which is bad.
Attachments
Patch (3.18 KB, patch)
2011-05-04 10:30 PDT, Simon Fraser (smfr)
no flags
Patch (2.98 KB, patch)
2011-05-04 10:42 PDT, Simon Fraser (smfr)
darin: review+
Simon Fraser (smfr)
Comment 1 2011-04-29 17:35:43 PDT
Simon Fraser (smfr)
Comment 2 2011-05-04 10:30:12 PDT
Darin Adler
Comment 3 2011-05-04 10:32:34 PDT
Comment on attachment 92273 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=92273&action=review > Source/WebCore/html/HTMLCanvasElement.h:103 > - GraphicsContext* drawingContext() const; > + enum ImageBufferCreation { AllowImageBufferCreation, DisallowImageBufferCreation }; > + GraphicsContext* drawingContext(ImageBufferCreation allowBufferCreation = AllowImageBufferCreation) const; Can we just add a second function with this behavior? Or maybe just a function that returns a boolean to tell us if we already have a buffer? I think that adding this argument is unnecessary given how simple the function is.
Darin Adler
Comment 4 2011-05-04 10:33:37 PDT
Comment on attachment 92273 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=92273&action=review >> Source/WebCore/html/HTMLCanvasElement.h:103 >> + GraphicsContext* drawingContext(ImageBufferCreation allowBufferCreation = AllowImageBufferCreation) const; > > Can we just add a second function with this behavior? Or maybe just a function that returns a boolean to tell us if we already have a buffer? I think that adding this argument is unnecessary given how simple the function is. One possible name for a new function would be existingDrawingContext. But I think that the hasImageBuffer solution would be fine.
Simon Fraser (smfr)
Comment 5 2011-05-04 10:39:46 PDT
Comment on attachment 92273 [details] Patch Yeah, sounds good.
Simon Fraser (smfr)
Comment 6 2011-05-04 10:42:27 PDT
Simon Fraser (smfr)
Comment 7 2011-05-04 10:51:14 PDT
Note You need to log in before you can comment on or make changes to this bug.