New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 774484 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature

Blocking:
issue 634542



Sign in to add a comment

Remove extra memory allocations in color managed canvas code path

Project Member Reported by zakerinasab@chromium.org, Oct 13 2017

Issue description

Currently 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.
 
We also have a couple of memory allocations in ImageBitmap constructor from ImageData. We should investigate if we can remove them too.

Summary: Remove extra memory allocations in ImageData::CropRect() and ImageBitmap(ImageData*)? (was: Investigate if we can remove the extra copy created in ImageData::CropRect())
Summary: Remove extra memory allocations in color managed canvas code path (was: Remove extra memory allocations in ImageData::CropRect() and ImageBitmap(ImageData*)?)
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. 

Labels: -Pri-3 Pri-2
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.
Project Member

Comment 6 by bugdroid1@chromium.org, 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

Labels: OS-Android
Status: Fixed (was: Assigned)
Blocking: 634542

Sign in to add a comment