Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: cc/playback/display_item_list.cc

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // TODO(jbroman): Does anything else owned by this class substantially 230 // TODO(jbroman): Does anything else owned by this class substantially
231 // contribute to memory usage? 231 // contribute to memory usage?
232 232
233 return memory_usage; 233 return memory_usage;
234 } 234 }
235 235
236 bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const { 236 bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const {
237 return ApproximateOpCount() <= kOpCountThatIsOkToAnalyze; 237 return ApproximateOpCount() <= kOpCountThatIsOkToAnalyze;
238 } 238 }
239 239
240 scoped_refptr<base::trace_event::ConvertableToTraceFormat> 240 scoped_ptr<base::trace_event::ConvertableToTraceFormat>
241 DisplayItemList::AsValue(bool include_items) const { 241 DisplayItemList::AsValue(bool include_items) const {
242 scoped_refptr<base::trace_event::TracedValue> state = 242 scoped_ptr<base::trace_event::TracedValue> state(
243 new base::trace_event::TracedValue(); 243 new base::trace_event::TracedValue());
244 244
245 state->BeginDictionary("params"); 245 state->BeginDictionary("params");
246 if (include_items) { 246 if (include_items) {
247 state->BeginArray("items"); 247 state->BeginArray("items");
248 size_t item_index = 0; 248 size_t item_index = 0;
249 for (const DisplayItem& item : items_) { 249 for (const DisplayItem& item : items_) {
250 item.AsValueInto(item_index < visual_rects_.size() 250 item.AsValueInto(item_index < visual_rects_.size()
251 ? visual_rects_[item_index] 251 ? visual_rects_[item_index]
252 : gfx::Rect(), 252 : gfx::Rect(),
253 state.get()); 253 state.get());
(...skipping 12 matching lines...) Expand all
266 canvas->clipRect(gfx::RectToSkRect(layer_rect_)); 266 canvas->clipRect(gfx::RectToSkRect(layer_rect_));
267 Raster(canvas, NULL, gfx::Rect(), 1.f); 267 Raster(canvas, NULL, gfx::Rect(), 1.f);
268 skia::RefPtr<SkPicture> picture = 268 skia::RefPtr<SkPicture> picture =
269 skia::AdoptRef(recorder.endRecordingAsPicture()); 269 skia::AdoptRef(recorder.endRecordingAsPicture());
270 270
271 std::string b64_picture; 271 std::string b64_picture;
272 PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture); 272 PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture);
273 state->SetString("skp64", b64_picture); 273 state->SetString("skp64", b64_picture);
274 } 274 }
275 275
276 return state; 276 return std::move(state);
277 } 277 }
278 278
279 void DisplayItemList::EmitTraceSnapshot() const { 279 void DisplayItemList::EmitTraceSnapshot() const {
280 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 280 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
281 TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items") "," 281 TRACE_DISABLED_BY_DEFAULT("cc.debug.display_items") ","
282 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," 282 TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") ","
283 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), 283 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"),
284 "cc::DisplayItemList", this, 284 "cc::DisplayItemList", this,
285 TracedDisplayItemList::AsTraceableDisplayItemList(this, 285 TracedDisplayItemList::AsTraceableDisplayItemList(this,
286 DisplayItemsTracingEnabled())); 286 DisplayItemsTracingEnabled()));
(...skipping 25 matching lines...) Expand all
312 bool DisplayItemList::HasDiscardableImageInRect( 312 bool DisplayItemList::HasDiscardableImageInRect(
313 const gfx::Rect& layer_rect) const { 313 const gfx::Rect& layer_rect) const {
314 return image_map_.HasDiscardableImageInRect(layer_rect); 314 return image_map_.HasDiscardableImageInRect(layer_rect);
315 } 315 }
316 316
317 bool DisplayItemList::MayHaveDiscardableImages() const { 317 bool DisplayItemList::MayHaveDiscardableImages() const {
318 return !image_map_.empty(); 318 return !image_map_.empty();
319 } 319 }
320 320
321 } // namespace cc 321 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698