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..6424fee414d394abd3c4e2970af3e0bdf7a9d842 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,23 @@ 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) |
+ items_[i]->RasterForTracing(canvas); |
+ skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
+ |
+ std::string b64_picture; |
+ PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture); |
+ state->SetString("skp64", b64_picture); |
+ |
return state; |
} |