OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/playback/display_item_list.h" | 5 #include "cc/playback/display_item_list.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 DCHECK(!retain_individual_display_items_); | 160 DCHECK(!retain_individual_display_items_); |
161 | 161 |
162 item.Raster(recorder_->getRecordingCanvas(), gfx::Rect(), nullptr); | 162 item.Raster(recorder_->getRecordingCanvas(), gfx::Rect(), nullptr); |
163 } | 163 } |
164 | 164 |
165 bool DisplayItemList::RetainsIndividualDisplayItems() const { | 165 bool DisplayItemList::RetainsIndividualDisplayItems() const { |
166 return retain_individual_display_items_; | 166 return retain_individual_display_items_; |
167 } | 167 } |
168 | 168 |
169 void DisplayItemList::Finalize() { | 169 void DisplayItemList::Finalize() { |
| 170 TRACE_EVENT0("cc", "DisplayItemList::Finalize"); |
170 // TODO(dtrainor): Need to deal with serializing visual_rects_. | 171 // TODO(dtrainor): Need to deal with serializing visual_rects_. |
171 // http://crbug.com/568757. | 172 // http://crbug.com/568757. |
172 DCHECK(!retain_individual_display_items_ || | 173 DCHECK(!retain_individual_display_items_ || |
173 items_.size() == visual_rects_.size()) | 174 items_.size() == visual_rects_.size()) |
174 << "items.size() " << items_.size() << " visual_rects.size() " | 175 << "items.size() " << items_.size() << " visual_rects.size() " |
175 << visual_rects_.size(); | 176 << visual_rects_.size(); |
176 | 177 |
177 // TODO(vmpstr): Build and make use of an RTree from the visual | 178 // TODO(vmpstr): Build and make use of an RTree from the visual |
178 // rects. For now we just clear them out since we won't ever need | 179 // rects. For now we just clear them out since we won't ever need |
179 // them to stick around post-Finalize. http://crbug.com/527245 | 180 // them to stick around post-Finalize. http://crbug.com/527245 |
(...skipping 13 matching lines...) Expand all Loading... |
193 is_suitable_for_gpu_rasterization_ = | 194 is_suitable_for_gpu_rasterization_ = |
194 picture_->suitableForGpuRasterization(nullptr); | 195 picture_->suitableForGpuRasterization(nullptr); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 bool DisplayItemList::IsSuitableForGpuRasterization() const { | 199 bool DisplayItemList::IsSuitableForGpuRasterization() const { |
199 return is_suitable_for_gpu_rasterization_; | 200 return is_suitable_for_gpu_rasterization_; |
200 } | 201 } |
201 | 202 |
202 int DisplayItemList::ApproximateOpCount() const { | 203 int DisplayItemList::ApproximateOpCount() const { |
203 return approximate_op_count_; | 204 if (retain_individual_display_items_) |
| 205 return approximate_op_count_; |
| 206 return picture_ ? picture_->approximateOpCount() : 0; |
204 } | 207 } |
205 | 208 |
206 size_t DisplayItemList::ApproximateMemoryUsage() const { | 209 size_t DisplayItemList::ApproximateMemoryUsage() const { |
207 // We double-count in this case. Produce zero to avoid being misleading. | 210 // We double-count in this case. Produce zero to avoid being misleading. |
208 if (settings_.use_cached_picture && retain_individual_display_items_) | 211 if (settings_.use_cached_picture && retain_individual_display_items_) |
209 return 0; | 212 return 0; |
210 | 213 |
211 DCHECK(!settings_.use_cached_picture || picture_); | 214 DCHECK(!settings_.use_cached_picture || picture_); |
212 | 215 |
213 size_t memory_usage = sizeof(*this); | 216 size_t memory_usage = sizeof(*this); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 305 } |
303 | 306 |
304 void DisplayItemList::GetDiscardableImagesInRect( | 307 void DisplayItemList::GetDiscardableImagesInRect( |
305 const gfx::Rect& rect, | 308 const gfx::Rect& rect, |
306 float raster_scale, | 309 float raster_scale, |
307 std::vector<DrawImage>* images) { | 310 std::vector<DrawImage>* images) { |
308 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); | 311 image_map_.GetDiscardableImagesInRect(rect, raster_scale, images); |
309 } | 312 } |
310 | 313 |
311 } // namespace cc | 314 } // namespace cc |
OLD | NEW |