Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: cc/tiles/image_decode_cache.h

Issue 2537683002: cc: Add image decode queue functionality to image manager. (Closed)
Patch Set: test fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/image_controller_unittest.cc ('k') | cc/tiles/software_image_decode_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TILES_IMAGE_DECODE_CACHE_H_ 5 #ifndef CC_TILES_IMAGE_DECODE_CACHE_H_
6 #define CC_TILES_IMAGE_DECODE_CACHE_H_ 6 #define CC_TILES_IMAGE_DECODE_CACHE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "cc/playback/decoded_draw_image.h" 9 #include "cc/playback/decoded_draw_image.h"
10 #include "cc/playback/draw_image.h" 10 #include "cc/playback/draw_image.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Fill in an TileTask which will decode the given image when run. In 55 // Fill in an TileTask which will decode the given image when run. In
56 // case the image is already cached, fills in nullptr. Returns true if the 56 // case the image is already cached, fills in nullptr. Returns true if the
57 // image needs to be unreffed when the caller is finished with it. 57 // image needs to be unreffed when the caller is finished with it.
58 // 58 //
59 // This is called by the tile manager (on the compositor thread) when creating 59 // This is called by the tile manager (on the compositor thread) when creating
60 // a raster task. 60 // a raster task.
61 virtual bool GetTaskForImageAndRef(const DrawImage& image, 61 virtual bool GetTaskForImageAndRef(const DrawImage& image,
62 const TracingInfo& tracing_info, 62 const TracingInfo& tracing_info,
63 scoped_refptr<TileTask>* task) = 0; 63 scoped_refptr<TileTask>* task) = 0;
64 // Similar to GetTaskForImageAndRef, except that it returns tasks that are not
65 // meant to be run as part of raster. That is, this is part of a predecode
66 // API. Note that this should only return a task responsible for decoding (and
67 // not uploading), since it will be run on a worker thread which may not have
68 // the right GPU context for upload.
69 virtual bool GetOutOfRasterDecodeTaskForImageAndRef(
70 const DrawImage& image,
71 scoped_refptr<TileTask>* task) = 0;
72
64 // Unrefs an image. When the tile is finished, this should be called for every 73 // Unrefs an image. When the tile is finished, this should be called for every
65 // GetTaskForImageAndRef call that returned true. 74 // GetTaskForImageAndRef call that returned true.
66 virtual void UnrefImage(const DrawImage& image) = 0; 75 virtual void UnrefImage(const DrawImage& image) = 0;
67 76
68 // Returns a decoded draw image. This may cause a decode if the image was not 77 // Returns a decoded draw image. This may cause a decode if the image was not
69 // predecoded. 78 // predecoded.
70 // 79 //
71 // This is called by a raster task (on a worker thread) when an image is 80 // This is called by a raster task (on a worker thread) when an image is
72 // required. 81 // required.
73 virtual DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) = 0; 82 virtual DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) = 0;
74 // Unrefs an image. This should be called for every GetDecodedImageForDraw 83 // Unrefs an image. This should be called for every GetDecodedImageForDraw
75 // when the draw with the image is finished. 84 // when the draw with the image is finished.
76 virtual void DrawWithImageFinished(const DrawImage& image, 85 virtual void DrawWithImageFinished(const DrawImage& image,
77 const DecodedDrawImage& decoded_image) = 0; 86 const DecodedDrawImage& decoded_image) = 0;
78 87
79 // This function informs the cache that now is a good time to clean up 88 // This function informs the cache that now is a good time to clean up
80 // memory. This is called periodically from the compositor thread. 89 // memory. This is called periodically from the compositor thread.
81 virtual void ReduceCacheUsage() = 0; 90 virtual void ReduceCacheUsage() = 0;
82 91
83 // This function informs the cache that we are hidden and should not be 92 // This function informs the cache that we are hidden and should not be
84 // retaining cached resources longer than needed. 93 // retaining cached resources longer than needed.
85 virtual void SetShouldAggressivelyFreeResources( 94 virtual void SetShouldAggressivelyFreeResources(
86 bool aggressively_free_resources) = 0; 95 bool aggressively_free_resources) = 0;
87 }; 96 };
88 97
89 } // namespace cc 98 } // namespace cc
90 99
91 #endif // CC_TILES_IMAGE_DECODE_CACHE_H_ 100 #endif // CC_TILES_IMAGE_DECODE_CACHE_H_
OLDNEW
« no previous file with comments | « cc/tiles/image_controller_unittest.cc ('k') | cc/tiles/software_image_decode_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698