Chromium Code Reviews| Index: cc/resources/display_item_list.cc |
| diff --git a/cc/resources/display_item_list.cc b/cc/resources/display_item_list.cc |
| index 2ead28d07344d1ee9efb4748d7ad0b46d2acf67d..5d4176eea608fb1ce94b8f01f3fad7c9c8fb6c49 100644 |
| --- a/cc/resources/display_item_list.cc |
| +++ b/cc/resources/display_item_list.cc |
| @@ -4,9 +4,15 @@ |
| #include "cc/resources/display_item_list.h" |
| +#include <string> |
| + |
| #include "base/debug/trace_event.h" |
| #include "base/debug/trace_event_argument.h" |
| +#include "cc/base/math_util.h" |
| +#include "cc/debug/picture_debug_util.h" |
| #include "third_party/skia/include/core/SkCanvas.h" |
| +#include "third_party/skia/include/core/SkPictureRecorder.h" |
| +#include "ui/gfx/skia_util.h" |
| namespace cc { |
| @@ -64,8 +70,24 @@ scoped_refptr<base::debug::ConvertableToTraceFormat> DisplayItemList::AsValue() |
| scoped_refptr<base::debug::TracedValue> state = |
| new base::debug::TracedValue(); |
| - // TODO(ajuma): Include the value of each item. |
| state->SetInteger("length", items_.size()); |
| + state->SetValue("params.layer_rect", |
| + MathUtil::AsValue(layer_rect_).release()); |
| + |
| + SkPictureRecorder recorder; |
| + SkCanvas* canvas = |
| + recorder.beginRecording(layer_rect_.width(), layer_rect_.height()); |
| + canvas->translate(-layer_rect_.x(), -layer_rect_.y()); |
| + canvas->clipRect(gfx::RectToSkRect(layer_rect_)); |
| + for (size_t i = 0; i < items_.size(); ++i) { |
|
vmpstr
2015/01/08 21:44:34
nit: braces optional
ajuma
2015/01/08 22:20:58
Removed.
|
| + items_[i]->RasterForTracing(canvas); |
| + } |
| + skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
| + |
| + std::string b64_picture; |
| + PictureDebugUtil::SerializeInBase64(picture.get(), &b64_picture); |
| + state->SetString("skp64", b64_picture); |
| + |
| return state; |
| } |