| 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" |
| 9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
| 11 #include "cc/base/math_util.h" | 12 #include "cc/base/math_util.h" |
| 12 #include "cc/debug/picture_debug_util.h" | 13 #include "cc/debug/picture_debug_util.h" |
| 13 #include "cc/debug/traced_picture.h" | 14 #include "cc/debug/traced_picture.h" |
| 14 #include "cc/debug/traced_value.h" | 15 #include "cc/debug/traced_value.h" |
| 15 #include "cc/playback/display_item_list_settings.h" | 16 #include "cc/playback/display_item_list_settings.h" |
| 16 #include "cc/playback/largest_display_item.h" | 17 #include "cc/playback/largest_display_item.h" |
| 17 #include "third_party/skia/include/core/SkCanvas.h" | 18 #include "third_party/skia/include/core/SkCanvas.h" |
| 18 #include "third_party/skia/include/core/SkPictureRecorder.h" | 19 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 DCHECK_IMPLIES(use_cached_picture_, picture_); | 208 DCHECK_IMPLIES(use_cached_picture_, picture_); |
| 208 return picture_memory_usage_; | 209 return picture_memory_usage_; |
| 209 } | 210 } |
| 210 | 211 |
| 211 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 212 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 212 DisplayItemList::AsValue() const { | 213 DisplayItemList::AsValue() const { |
| 213 DCHECK(ProcessAppendedItemsCalled()); | 214 DCHECK(ProcessAppendedItemsCalled()); |
| 214 scoped_refptr<base::trace_event::TracedValue> state = | 215 scoped_refptr<base::trace_event::TracedValue> state = |
| 215 new base::trace_event::TracedValue(); | 216 new base::trace_event::TracedValue(); |
| 216 | 217 |
| 217 state->SetInteger("length", items_.size()); | 218 state->SetInteger("length", base::saturated_cast<int>(items_.size())); |
| 218 state->BeginArray("params.items"); | 219 state->BeginArray("params.items"); |
| 219 for (const DisplayItem* item : items_) { | 220 for (const DisplayItem* item : items_) { |
| 220 item->AsValueInto(state.get()); | 221 item->AsValueInto(state.get()); |
| 221 } | 222 } |
| 222 state->EndArray(); | 223 state->EndArray(); |
| 223 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); | 224 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); |
| 224 | 225 |
| 225 if (!layer_rect_.IsEmpty()) { | 226 if (!layer_rect_.IsEmpty()) { |
| 226 SkPictureRecorder recorder; | 227 SkPictureRecorder recorder; |
| 227 SkCanvas* canvas = | 228 SkCanvas* canvas = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 258 return; | 259 return; |
| 259 | 260 |
| 260 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); | 261 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { | 264 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { |
| 264 return items_.GetSidecar(display_item); | 265 return items_.GetSidecar(display_item); |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace cc | 268 } // namespace cc |
| OLD | NEW |