| 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 #include "cc/tiles/image_decode_controller.h" | 5 #include "cc/tiles/image_decode_controller.h" |
| 6 | 6 |
| 7 #include "cc/debug/devtools_instrumentation.h" | 7 #include "cc/debug/devtools_instrumentation.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 namespace { | 10 namespace { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DISALLOW_COPY_AND_ASSIGN(ImageDecodeTaskImpl); | 53 DISALLOW_COPY_AND_ASSIGN(ImageDecodeTaskImpl); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace | 56 } // namespace |
| 57 | 57 |
| 58 ImageDecodeController::ImageDecodeController() {} | 58 ImageDecodeController::ImageDecodeController() {} |
| 59 | 59 |
| 60 ImageDecodeController::~ImageDecodeController() {} | 60 ImageDecodeController::~ImageDecodeController() {} |
| 61 | 61 |
| 62 scoped_refptr<ImageDecodeTask> ImageDecodeController::GetTaskForPixelRef( | 62 scoped_refptr<ImageDecodeTask> ImageDecodeController::GetTaskForPixelRef( |
| 63 SkPixelRef* pixel_ref, | 63 const skia::PositionPixelRef& pixel_ref, |
| 64 int layer_id, | 64 int layer_id, |
| 65 uint64_t prepare_tiles_id) { | 65 uint64_t prepare_tiles_id) { |
| 66 uint32_t generation_id = pixel_ref->getGenerationID(); | 66 uint32_t generation_id = pixel_ref.pixel_ref->getGenerationID(); |
| 67 scoped_refptr<ImageDecodeTask>& decode_task = | 67 scoped_refptr<ImageDecodeTask>& decode_task = |
| 68 image_decode_tasks_[layer_id][generation_id]; | 68 image_decode_tasks_[layer_id][generation_id]; |
| 69 if (!decode_task) | 69 if (!decode_task) |
| 70 decode_task = CreateTaskForPixelRef(pixel_ref, layer_id, prepare_tiles_id); | 70 decode_task = |
| 71 CreateTaskForPixelRef(pixel_ref.pixel_ref, layer_id, prepare_tiles_id); |
| 71 return decode_task; | 72 return decode_task; |
| 72 } | 73 } |
| 73 | 74 |
| 74 scoped_refptr<ImageDecodeTask> ImageDecodeController::CreateTaskForPixelRef( | 75 scoped_refptr<ImageDecodeTask> ImageDecodeController::CreateTaskForPixelRef( |
| 75 SkPixelRef* pixel_ref, | 76 SkPixelRef* pixel_ref, |
| 76 int layer_id, | 77 int layer_id, |
| 77 uint64_t prepare_tiles_id) { | 78 uint64_t prepare_tiles_id) { |
| 78 return make_scoped_refptr( | 79 return make_scoped_refptr( |
| 79 new ImageDecodeTaskImpl(this, pixel_ref, layer_id, prepare_tiles_id)); | 80 new ImageDecodeTaskImpl(this, pixel_ref, layer_id, prepare_tiles_id)); |
| 80 } | 81 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 116 |
| 116 PixelRefTaskMap& pixel_ref_tasks = layer_it->second; | 117 PixelRefTaskMap& pixel_ref_tasks = layer_it->second; |
| 117 PixelRefTaskMap::iterator task_it = | 118 PixelRefTaskMap::iterator task_it = |
| 118 pixel_ref_tasks.find(pixel_ref->getGenerationID()); | 119 pixel_ref_tasks.find(pixel_ref->getGenerationID()); |
| 119 if (task_it == pixel_ref_tasks.end()) | 120 if (task_it == pixel_ref_tasks.end()) |
| 120 return; | 121 return; |
| 121 pixel_ref_tasks.erase(task_it); | 122 pixel_ref_tasks.erase(task_it); |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace cc | 125 } // namespace cc |
| OLD | NEW |