// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_TILES_IMAGE_DECODE_CACHE_H_ #define CC_TILES_IMAGE_DECODE_CACHE_H_ #include <atomic> #include "base/memory/ref_counted.h" #include "base/notreached.h" #include "cc/base/devtools_instrumentation.h" #include "cc/cc_export.h" #include "cc/paint/decoded_draw_image.h" #include "cc/paint/draw_image.h" #include "cc/raster/tile_task.h" #include "cc/tiles/image_decode_cache_utils.h" #include "cc/tiles/tile_priority.h" namespace cc { // ImageDecodeCache is responsible for generating decode tasks, decoding // images, storing images in cache, and being able to return the decoded images // when requested. // ImageDecodeCache is responsible for the following things: // 1. Given a DrawImage, it can return an TileTask which when run will // decode and cache the resulting image. If the image does not need a task to // be decoded, then nullptr will be returned. The return value of the // function indicates whether the image was or is going to be locked, so an // unlock will be required. // 2. Given a cache key and a DrawImage, it can decode the image and store it in // the cache. Note that it is important that this function is only accessed // via an image decode task. // 3. Given a DrawImage, it can return a DecodedDrawImage, which represented the // decoded version of the image. Note that if the image is not in the cache // and it needs to be scaled/decoded, then this decode will happen as part of // getting the image. As such, this should only be accessed from a raster // thread. class CC_EXPORT ImageDecodeCache { … }; } // namespace cc #endif // CC_TILES_IMAGE_DECODE_CACHE_H_