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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/cc.gyp ('k') | cc/tiles/image_decode_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/image_decode_controller.h
diff --git a/cc/tiles/image_decode_controller.h b/cc/tiles/image_decode_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..902927f4a77efa1779dcb3aaa39bcc8e31c55db2
--- /dev/null
+++ b/cc/tiles/image_decode_controller.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// 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_CONTROLLER_H_
+#define CC_TILES_IMAGE_DECODE_CONTROLLER_H_
+
+#include "base/containers/hash_tables.h"
+#include "base/memory/ref_counted.h"
+#include "cc/base/cc_export.h"
+#include "cc/raster/tile_task_runner.h"
+#include "skia/ext/refptr.h"
+#include "third_party/skia/include/core/SkPixelRef.h"
+
+namespace cc {
+
+class ImageDecodeController {
+ public:
+ ImageDecodeController();
+ ~ImageDecodeController();
+
+ scoped_refptr<ImageDecodeTask> GetTaskForPixelRef(SkPixelRef* pixel_ref,
+ int layer_id,
+ uint64_t prepare_tiles_id);
+
+ // Note that this function has to remain thread safe.
+ void DecodePixelRef(SkPixelRef* pixel_ref);
+
+ // TODO(vmpstr): This should go away once the controller is decoding images
+ // based on priority and memory.
+ void AddLayerUsedCount(int layer_id);
+ void SubtractLayerUsedCount(int layer_id);
+
+ void OnImageDecodeTaskCompleted(int layer_id,
+ SkPixelRef* pixel_ref,
+ bool was_canceled);
+
+ private:
+ scoped_refptr<ImageDecodeTask> CreateTaskForPixelRef(
+ SkPixelRef* pixel_ref,
+ int layer_id,
+ uint64_t prepare_tiles_id);
+
+ using PixelRefTaskMap =
+ base::hash_map<uint32_t, scoped_refptr<ImageDecodeTask>>;
+ using LayerPixelRefTaskMap = base::hash_map<int, PixelRefTaskMap>;
+ LayerPixelRefTaskMap image_decode_tasks_;
+
+ using LayerCountMap = base::hash_map<int, int>;
+ LayerCountMap used_layer_counts_;
+};
+
+} // namespace cc
+
+#endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_
« 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