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

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

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « cc/resources/display_item.h ('k') | cc/resources/drawing_display_item.h » ('j') | 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/resources/display_item_list.h" 5 #include "cc/resources/display_item_list.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 return total_size; 65 return total_size;
66 } 66 }
67 67
68 scoped_refptr<base::debug::ConvertableToTraceFormat> DisplayItemList::AsValue() 68 scoped_refptr<base::debug::ConvertableToTraceFormat> DisplayItemList::AsValue()
69 const { 69 const {
70 scoped_refptr<base::debug::TracedValue> state = 70 scoped_refptr<base::debug::TracedValue> state =
71 new base::debug::TracedValue(); 71 new base::debug::TracedValue();
72 72
73 state->SetInteger("length", items_.size()); 73 state->SetInteger("length", items_.size());
74 state->BeginArray("params.items");
75 for (const DisplayItem* item : items_) {
76 item->AsValueInto(state.get());
77 }
78 state->EndArray();
74 state->SetValue("params.layer_rect", 79 state->SetValue("params.layer_rect",
75 MathUtil::AsValue(layer_rect_).release()); 80 MathUtil::AsValue(layer_rect_).release());
76 81
77 SkPictureRecorder recorder; 82 SkPictureRecorder recorder;
78 SkCanvas* canvas = 83 SkCanvas* canvas =
79 recorder.beginRecording(layer_rect_.width(), layer_rect_.height()); 84 recorder.beginRecording(layer_rect_.width(), layer_rect_.height());
80 canvas->translate(-layer_rect_.x(), -layer_rect_.y()); 85 canvas->translate(-layer_rect_.x(), -layer_rect_.y());
81 canvas->clipRect(gfx::RectToSkRect(layer_rect_)); 86 canvas->clipRect(gfx::RectToSkRect(layer_rect_));
82 for (size_t i = 0; i < items_.size(); ++i) 87 for (size_t i = 0; i < items_.size(); ++i)
83 items_[i]->RasterForTracing(canvas); 88 items_[i]->RasterForTracing(canvas);
84 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); 89 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
85 90
86 std::string b64_picture; 91 std::string b64_picture;
87 PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture); 92 PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture);
88 state->SetString("skp64", b64_picture); 93 state->SetString("skp64", b64_picture);
89 94
90 return state; 95 return state;
91 } 96 }
92 97
93 void DisplayItemList::EmitTraceSnapshot() const { 98 void DisplayItemList::EmitTraceSnapshot() const {
94 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( 99 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(
95 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT( 100 TRACE_DISABLED_BY_DEFAULT("cc.debug") "," TRACE_DISABLED_BY_DEFAULT(
96 "devtools.timeline.picture"), 101 "devtools.timeline.picture"),
97 "cc::DisplayItemList", this, AsValue()); 102 "cc::DisplayItemList", this, AsValue());
98 } 103 }
99 104
100 } // namespace cc 105 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/display_item.h ('k') | cc/resources/drawing_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698