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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 DCHECK_IMPLIES(use_cached_picture_, picture_); | 198 DCHECK_IMPLIES(use_cached_picture_, picture_); |
198 return picture_memory_usage_; | 199 return picture_memory_usage_; |
199 } | 200 } |
200 | 201 |
201 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 202 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
202 DisplayItemList::AsValue() const { | 203 DisplayItemList::AsValue() const { |
203 DCHECK(ProcessAppendedItemsCalled()); | 204 DCHECK(ProcessAppendedItemsCalled()); |
204 scoped_refptr<base::trace_event::TracedValue> state = | 205 scoped_refptr<base::trace_event::TracedValue> state = |
205 new base::trace_event::TracedValue(); | 206 new base::trace_event::TracedValue(); |
206 | 207 |
207 state->SetInteger("length", items_.size()); | 208 state->SetInteger("length", base::saturated_cast<int>(items_.size())); |
208 state->BeginArray("params.items"); | 209 state->BeginArray("params.items"); |
209 for (const DisplayItem* item : items_) { | 210 for (const DisplayItem* item : items_) { |
210 item->AsValueInto(state.get()); | 211 item->AsValueInto(state.get()); |
211 } | 212 } |
212 state->EndArray(); | 213 state->EndArray(); |
213 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); | 214 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); |
214 | 215 |
215 if (!layer_rect_.IsEmpty()) { | 216 if (!layer_rect_.IsEmpty()) { |
216 SkPictureRecorder recorder; | 217 SkPictureRecorder recorder; |
217 SkCanvas* canvas = | 218 SkCanvas* canvas = |
(...skipping 30 matching lines...) Expand all Loading... |
248 return; | 249 return; |
249 | 250 |
250 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); | 251 pixel_refs_->GatherPixelRefsFromPicture(picture_.get()); |
251 } | 252 } |
252 | 253 |
253 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { | 254 void* DisplayItemList::GetSidecar(DisplayItem* display_item) { |
254 return items_.GetSidecar(display_item); | 255 return items_.GetSidecar(display_item); |
255 } | 256 } |
256 | 257 |
257 } // namespace cc | 258 } // namespace cc |
OLD | NEW |