Remove extra memory allocations in color managed canvas code path |
||||||
Issue descriptionCurrently ImageData::CropRect() creates a copy of the cropped portion of the source ImageData and returns it in a new object. As a rule of thumb ImageData belongs to the user and its state should not change unless directly modified by the user. Therefore, we should be able to remove this extra copy and return a "cropped view" on the source ImageData object.
,
Oct 13 2017
,
Oct 13 2017
Similarly, ImageData::ImageDataInCanvasColorSettings() creates a copy of data even when color conversion is not needed. The copy is passed to ImageBuffer::PutByteArray() and from there to ImageBufferSurface::WritePixels(). We can return a pointer to the ImageData internal array like the old non-color-managed code path.
,
Oct 25 2017
,
Oct 27 2017
After an internal discussion regarding comment 1, we decided to leave it for now as is. The allocated memory will be released at the end of the constructor and gets collected by Oilpan, hopefully soon enough to not make a big case from this.
,
Nov 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9dd181e41920a8779bdb532a987851a260088889 commit 9dd181e41920a8779bdb532a987851a260088889 Author: Reza.Zakerinasab <zakerinasab@chromium.org> Date: Mon Nov 06 22:04:53 2017 Refactor ImageBitmap from ImageData code path This change refactors ImageBitmap from ImageData constructor to remove the extra memory usage due to creating a cropped version of the ImageData. Bug: 774484 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: Iae0d35ce1014f0061535c709d174414a92151190 Reviewed-on: https://chromium-review.googlesource.com/751401 Reviewed-by: Fernando Serboncini <fserb@chromium.org> Reviewed-by: Justin Novosad <junov@chromium.org> Commit-Queue: Mohammad Reza Zakerinasab <zakerinasab@chromium.org> Cr-Commit-Position: refs/heads/master@{#514253} [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/core/html/ImageData.cpp [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/core/html/ImageData.h [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/core/html/ImageDataTest.cpp [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.cpp [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/core/imagebitmap/ImageBitmap.h [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/modules/canvas/canvas2d/BaseRenderingContext2D.cpp [modify] https://crrev.com/9dd181e41920a8779bdb532a987851a260088889/third_party/WebKit/Source/platform/graphics/GraphicsTypes.h
,
Nov 7 2017
,
Nov 27 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by zakerinasab@chromium.org
, Oct 13 2017