OLD | NEW |
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_CONTROLLER_H_ | 5 #ifndef CC_TILES_IMAGE_DECODE_CONTROLLER_H_ |
6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_ | 6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
11 #include "cc/raster/tile_task_runner.h" | 11 #include "cc/raster/tile_task_runner.h" |
| 12 #include "skia/ext/pixel_ref_utils.h" |
12 #include "skia/ext/refptr.h" | 13 #include "skia/ext/refptr.h" |
13 #include "third_party/skia/include/core/SkPixelRef.h" | 14 #include "third_party/skia/include/core/SkPixelRef.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class ImageDecodeController { | 18 class ImageDecodeController { |
18 public: | 19 public: |
19 ImageDecodeController(); | 20 ImageDecodeController(); |
20 ~ImageDecodeController(); | 21 ~ImageDecodeController(); |
21 | 22 |
22 scoped_refptr<ImageDecodeTask> GetTaskForPixelRef(SkPixelRef* pixel_ref, | 23 scoped_refptr<ImageDecodeTask> GetTaskForPixelRef( |
23 int layer_id, | 24 const skia::PositionPixelRef& pixel_ref, |
24 uint64_t prepare_tiles_id); | 25 int layer_id, |
| 26 uint64_t prepare_tiles_id); |
25 | 27 |
26 // Note that this function has to remain thread safe. | 28 // Note that this function has to remain thread safe. |
27 void DecodePixelRef(SkPixelRef* pixel_ref); | 29 void DecodePixelRef(SkPixelRef* pixel_ref); |
28 | 30 |
29 // TODO(vmpstr): This should go away once the controller is decoding images | 31 // TODO(vmpstr): This should go away once the controller is decoding images |
30 // based on priority and memory. | 32 // based on priority and memory. |
31 void AddLayerUsedCount(int layer_id); | 33 void AddLayerUsedCount(int layer_id); |
32 void SubtractLayerUsedCount(int layer_id); | 34 void SubtractLayerUsedCount(int layer_id); |
33 | 35 |
34 void OnImageDecodeTaskCompleted(int layer_id, | 36 void OnImageDecodeTaskCompleted(int layer_id, |
(...skipping 11 matching lines...) Expand all Loading... |
46 using LayerPixelRefTaskMap = base::hash_map<int, PixelRefTaskMap>; | 48 using LayerPixelRefTaskMap = base::hash_map<int, PixelRefTaskMap>; |
47 LayerPixelRefTaskMap image_decode_tasks_; | 49 LayerPixelRefTaskMap image_decode_tasks_; |
48 | 50 |
49 using LayerCountMap = base::hash_map<int, int>; | 51 using LayerCountMap = base::hash_map<int, int>; |
50 LayerCountMap used_layer_counts_; | 52 LayerCountMap used_layer_counts_; |
51 }; | 53 }; |
52 | 54 |
53 } // namespace cc | 55 } // namespace cc |
54 | 56 |
55 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_ | 57 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_ |
OLD | NEW |