| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Warning: this double-counts SkPicture data if use_cached_picture_ is | 152 // Warning: this double-counts SkPicture data if use_cached_picture_ is |
| 153 // also true. | 153 // also true. |
| 154 picture_memory_usage_ += item->picture_memory_usage(); | 154 picture_memory_usage_ += item->picture_memory_usage(); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 if (!retain_individual_display_items_) | 158 if (!retain_individual_display_items_) |
| 159 items_.clear(); | 159 items_.clear(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void DisplayItemList::RemoveLast() { |
| 163 // We cannot remove the last item if it has been squashed into a picture. |
| 164 // The last item should not have been handled by ProcessAppendedItems, so we |
| 165 // don't need to remove it from approximate_op_count_, etc. |
| 166 DCHECK(retain_individual_display_items_); |
| 167 DCHECK(!use_cached_picture_); |
| 168 items_.RemoveLast(); |
| 169 } |
| 170 |
| 162 void DisplayItemList::Finalize() { | 171 void DisplayItemList::Finalize() { |
| 163 ProcessAppendedItems(); | 172 ProcessAppendedItems(); |
| 164 | 173 |
| 165 if (use_cached_picture_) { | 174 if (use_cached_picture_) { |
| 166 // Convert to an SkPicture for faster rasterization. | 175 // Convert to an SkPicture for faster rasterization. |
| 167 DCHECK(use_cached_picture_); | 176 DCHECK(use_cached_picture_); |
| 168 DCHECK(!picture_); | 177 DCHECK(!picture_); |
| 169 picture_ = skia::AdoptRef(recorder_->endRecordingAsPicture()); | 178 picture_ = skia::AdoptRef(recorder_->endRecordingAsPicture()); |
| 170 DCHECK(picture_); | 179 DCHECK(picture_); |
| 171 picture_memory_usage_ += | 180 picture_memory_usage_ += |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 return; | 257 return; |
| 249 | 258 |
| 250 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); | 259 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); |
| 251 } | 260 } |
| 252 | 261 |
| 253 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { | 262 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { |
| 254 return items_.GetSidecar(display_item); | 263 return items_.GetSidecar(display_item); |
| 255 } | 264 } |
| 256 | 265 |
| 257 } // namespace cc | 266 } // namespace cc |
| OLD | NEW |