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

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

Issue 1354493003: [tracing] Don't use dot-based path expansion in TracedValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cc display list tracing Created 5 years, 3 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
« no previous file with comments | « base/trace_event/trace_event_argument_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 8
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const { 224 bool DisplayItemList::ShouldBeAnalyzedForSolidColor() const {
225 return ApproximateOpCount() <= kOpCountThatIsOkToAnalyze; 225 return ApproximateOpCount() <= kOpCountThatIsOkToAnalyze;
226 } 226 }
227 227
228 scoped_refptr<base::trace_event::ConvertableToTraceFormat> 228 scoped_refptr<base::trace_event::ConvertableToTraceFormat>
229 DisplayItemList::AsValue(bool include_items) const { 229 DisplayItemList::AsValue(bool include_items) const {
230 DCHECK(ProcessAppendedItemsCalled()); 230 DCHECK(ProcessAppendedItemsCalled());
231 scoped_refptr<base::trace_event::TracedValue> state = 231 scoped_refptr<base::trace_event::TracedValue> state =
232 new base::trace_event::TracedValue(); 232 new base::trace_event::TracedValue();
233 233
234 state->BeginDictionary("params");
234 if (include_items) { 235 if (include_items) {
235 state->BeginArray("params.items"); 236 state->BeginArray("items");
236 for (const DisplayItem* item : items_) { 237 for (const DisplayItem* item : items_) {
237 item->AsValueInto(state.get()); 238 item->AsValueInto(state.get());
238 } 239 }
239 state->EndArray(); 240 state->EndArray(); // "items".
240 } 241 }
241 242 state->SetValue("layer_rect", MathUtil::AsValue(layer_rect_));
242 state->SetValue("params.layer_rect", MathUtil::AsValue(layer_rect_)); 243 state->EndDictionary(); // "params".
243 244
244 if (!layer_rect_.IsEmpty()) { 245 if (!layer_rect_.IsEmpty()) {
245 SkPictureRecorder recorder; 246 SkPictureRecorder recorder;
246 SkCanvas* canvas = 247 SkCanvas* canvas =
247 recorder.beginRecording(layer_rect_.width(), layer_rect_.height()); 248 recorder.beginRecording(layer_rect_.width(), layer_rect_.height());
248 canvas->translate(-layer_rect_.x(), -layer_rect_.y()); 249 canvas->translate(-layer_rect_.x(), -layer_rect_.y());
249 canvas->clipRect(gfx::RectToSkRect(layer_rect_)); 250 canvas->clipRect(gfx::RectToSkRect(layer_rect_));
250 Raster(canvas, NULL, gfx::Rect(), 1.f); 251 Raster(canvas, NULL, gfx::Rect(), 1.f);
251 skia::RefPtr<SkPicture> picture = 252 skia::RefPtr<SkPicture> picture =
252 skia::AdoptRef(recorder.endRecordingAsPicture()); 253 skia::AdoptRef(recorder.endRecordingAsPicture());
(...skipping 23 matching lines...) Expand all
276 DCHECK(picture_); 277 DCHECK(picture_);
277 DCHECK(!images_); 278 DCHECK(!images_);
278 images_ = make_scoped_ptr(new DiscardableImageMap(grid_cell_size)); 279 images_ = make_scoped_ptr(new DiscardableImageMap(grid_cell_size));
279 if (!picture_->willPlayBackBitmaps()) 280 if (!picture_->willPlayBackBitmaps())
280 return; 281 return;
281 282
282 images_->GatherImagesFromPicture(picture_.get(), layer_rect_); 283 images_->GatherImagesFromPicture(picture_.get(), layer_rect_);
283 } 284 }
284 285
285 } // namespace cc 286 } // namespace cc
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_argument_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698