| 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/numerics/safe_conversions.h" | |
| 10 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 11 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| 12 #include "cc/base/math_util.h" | 11 #include "cc/base/math_util.h" |
| 13 #include "cc/debug/picture_debug_util.h" | 12 #include "cc/debug/picture_debug_util.h" |
| 14 #include "cc/debug/traced_picture.h" | 13 #include "cc/debug/traced_picture.h" |
| 15 #include "cc/debug/traced_value.h" | 14 #include "cc/debug/traced_value.h" |
| 16 #include "cc/playback/display_item_list_settings.h" | 15 #include "cc/playback/display_item_list_settings.h" |
| 17 #include "cc/playback/largest_display_item.h" | 16 #include "cc/playback/largest_display_item.h" |
| 18 #include "third_party/skia/include/core/SkCanvas.h" | 17 #include "third_party/skia/include/core/SkCanvas.h" |
| 19 #include "third_party/skia/include/core/SkPictureRecorder.h" | 18 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 DCHECK_IMPLIES(use_cached_picture_, picture_); | 198 DCHECK_IMPLIES(use_cached_picture_, picture_); |
| 200 return picture_memory_usage_; | 199 return picture_memory_usage_; |
| 201 } | 200 } |
| 202 | 201 |
| 203 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 202 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 204 DisplayItemList::AsValue() const { | 203 DisplayItemList::AsValue() const { |
| 205 DCHECK(ProcessAppendedItemsCalled()); | 204 DCHECK(ProcessAppendedItemsCalled()); |
| 206 scoped_refptr<base::trace_event::TracedValue> state = | 205 scoped_refptr<base::trace_event::TracedValue> state = |
| 207 new base::trace_event::TracedValue(); | 206 new base::trace_event::TracedValue(); |
| 208 | 207 |
| 209 state->SetInteger("length", base::saturated_cast<int>(items_.size())); | 208 state->SetInteger("length", items_.size()); |
| 210 state->BeginArray("params.items"); | 209 state->BeginArray("params.items"); |
| 211 for (const DisplayItem* item : items_) { | 210 for (const DisplayItem* item : items_) { |
| 212 item->AsValueInto(state.get()); | 211 item->AsValueInto(state.get()); |
| 213 } | 212 } |
| 214 state->EndArray(); | 213 state->EndArray(); |
| 215 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); | 214 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); |
| 216 | 215 |
| 217 if (!layer_rect_.IsEmpty()) { | 216 if (!layer_rect_.IsEmpty()) { |
| 218 SkPictureRecorder recorder; | 217 SkPictureRecorder recorder; |
| 219 SkCanvas* canvas = | 218 SkCanvas* canvas = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 250 return; | 249 return; |
| 251 | 250 |
| 252 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); | 251 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); |
| 253 } | 252 } |
| 254 | 253 |
| 255 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { | 254 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { |
| 256 return items_.GetSidecar(display_item); | 255 return items_.GetSidecar(display_item); |
| 257 } | 256 } |
| 258 | 257 |
| 259 } // namespace cc | 258 } // namespace cc |
| OLD | NEW |