Commit cde9d1d1 authored by Khushal's avatar Khushal Committed by Commit Bot

canvas: Avoid unnecessary book-keeping of images in CanvasImageProvider.

If an image can be used for raster directly, it doesn't need to hit
the decode cache or be unlocked. Avoid unnecessary tracking for them
in CanvasImageProvider.

R=ericrk@chromium.org, junov@chromium.org

Bug: 809130
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ib899f79c8a208f3bcb2395595162561e12757987
Reviewed-on: https://chromium-review.googlesource.com/919966Reviewed-by: default avatarJustin Novosad <junov@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537430}
parent 47275743
......@@ -36,6 +36,7 @@ class CC_PAINT_EXPORT ImageProvider {
return image_.image() || image_.transfer_cache_entry_id();
}
const DecodedDrawImage& decoded_image() const { return image_; }
bool needs_unlock() const { return !destruction_callback_.is_null(); }
private:
void DestroyDecode();
......
......@@ -1660,6 +1660,8 @@ GpuImageDecodeCache::ImageData* GpuImageDecodeCache::GetImageDataForDrawImage(
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug"),
"GpuImageDecodeCache::GetImageDataForDrawImage");
lock_.AssertAcquired();
DCHECK(!draw_image.paint_image().GetSkImage()->isTextureBacked());
auto found_in_use =
in_use_cache_.find(InUseCacheKey::FromDrawImage(draw_image));
if (found_in_use != in_use_cache_.end())
......
......@@ -148,6 +148,8 @@ SoftwareImageDecodeCacheUtils::GenerateCacheEntryFromCandidate(
SoftwareImageDecodeCacheUtils::CacheKey
SoftwareImageDecodeCacheUtils::CacheKey::FromDrawImage(const DrawImage& image,
SkColorType color_type) {
DCHECK(!image.paint_image().GetSkImage()->isTextureBacked());
const PaintImage::FrameKey frame_key = image.frame_key();
const SkSize& scale = image.scale();
......
......@@ -318,6 +318,9 @@ CanvasResourceProvider::CanvasImageProvider::GetDecodedDrawImage(
const cc::DrawImage& draw_image) {
auto scoped_decoded_image =
playback_image_provider_.GetDecodedDrawImage(draw_image);
if (!scoped_decoded_image.needs_unlock())
return scoped_decoded_image;
if (!scoped_decoded_image.decoded_image().is_budgeted()) {
// If we have exceeded the budget, ReleaseLockedImages any locked decodes.
ReleaseLockedImages();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment