OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/tile.h" | 5 #include "cc/tiles/tile.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 value->SetBoolean("has_resource", draw_info().has_resource()); | 62 value->SetBoolean("has_resource", draw_info().has_resource()); |
63 value->SetBoolean("is_using_gpu_memory", | 63 value->SetBoolean("is_using_gpu_memory", |
64 draw_info().has_resource() || HasRasterTask()); | 64 draw_info().has_resource() || HasRasterTask()); |
65 value->SetInteger("scheduled_priority", scheduled_priority_); | 65 value->SetInteger("scheduled_priority", scheduled_priority_); |
66 value->SetBoolean("use_picture_analysis", use_picture_analysis()); | 66 value->SetBoolean("use_picture_analysis", use_picture_analysis()); |
67 value->SetInteger("gpu_memory_usage", | 67 value->SetInteger("gpu_memory_usage", |
68 base::saturated_cast<int>(GPUMemoryUsageInBytes())); | 68 base::saturated_cast<int>(GPUMemoryUsageInBytes())); |
69 } | 69 } |
70 | 70 |
| 71 void Tile::SetImageAnalysisResult( |
| 72 std::vector<DrawImage> images_to_decode_before_raster, |
| 73 std::vector<sk_sp<const SkImage>> images_to_checker) { |
| 74 DCHECK(!is_image_analysis_performed_) |
| 75 << "Image Analysis for a tile should be performed once only"; |
| 76 |
| 77 is_image_analysis_performed_ = true; |
| 78 images_to_decode_before_raster_ = std::move(images_to_decode_before_raster); |
| 79 images_to_checker_ = std::move(images_to_checker); |
| 80 } |
| 81 |
71 size_t Tile::GPUMemoryUsageInBytes() const { | 82 size_t Tile::GPUMemoryUsageInBytes() const { |
72 if (draw_info_.resource_) { | 83 if (draw_info_.resource_) { |
73 // We can use UncheckedSizeInBytes, since the tile size is determined by the | 84 // We can use UncheckedSizeInBytes, since the tile size is determined by the |
74 // compositor. | 85 // compositor. |
75 return ResourceUtil::UncheckedSizeInBytes<size_t>( | 86 return ResourceUtil::UncheckedSizeInBytes<size_t>( |
76 draw_info_.resource_->size(), draw_info_.resource_->format()); | 87 draw_info_.resource_->size(), draw_info_.resource_->format()); |
77 } | 88 } |
78 return 0; | 89 return 0; |
79 } | 90 } |
80 | 91 |
81 } // namespace cc | 92 } // namespace cc |
OLD | NEW |