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

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

Issue 1246633004: cc: Move image decodes from tile manager to a separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 4 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/cc.gyp ('k') | cc/tiles/image_decode_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TILES_IMAGE_DECODE_CONTROLLER_H_
6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_
7
8 #include "base/containers/hash_tables.h"
9 #include "base/memory/ref_counted.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/raster/tile_task_runner.h"
12 #include "skia/ext/refptr.h"
13 #include "third_party/skia/include/core/SkPixelRef.h"
14
15 namespace cc {
16
17 class ImageDecodeController {
18 public:
19 ImageDecodeController();
20 ~ImageDecodeController();
21
22 scoped_refptr<ImageDecodeTask> GetTaskForPixelRef(SkPixelRef* pixel_ref,
23 int layer_id,
24 uint64_t prepare_tiles_id);
25
26 // Note that this function has to remain thread safe.
27 void DecodePixelRef(SkPixelRef* pixel_ref);
28
29 // TODO(vmpstr): This should go away once the controller is decoding images
30 // based on priority and memory.
31 void AddLayerUsedCount(int layer_id);
32 void SubtractLayerUsedCount(int layer_id);
33
34 void OnImageDecodeTaskCompleted(int layer_id,
35 SkPixelRef* pixel_ref,
36 bool was_canceled);
37
38 private:
39 scoped_refptr<ImageDecodeTask> CreateTaskForPixelRef(
40 SkPixelRef* pixel_ref,
41 int layer_id,
42 uint64_t prepare_tiles_id);
43
44 using PixelRefTaskMap =
45 base::hash_map<uint32_t, scoped_refptr<ImageDecodeTask>>;
46 using LayerPixelRefTaskMap = base::hash_map<int, PixelRefTaskMap>;
47 LayerPixelRefTaskMap image_decode_tasks_;
48
49 using LayerCountMap = base::hash_map<int, int>;
50 LayerCountMap used_layer_counts_;
51 };
52
53 } // namespace cc
54
55 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/tiles/image_decode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698