Index: cc/layer_tree_host_impl.cc |
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc |
index c295e920432a6a22acd80869e3e09b513de998f1..6a6a98232351ef72aa1b89a4d6cd186e85e518e7 100644 |
--- a/cc/layer_tree_host_impl.cc |
+++ b/cc/layer_tree_host_impl.cc |
@@ -8,6 +8,7 @@ |
#include "base/basictypes.h" |
#include "base/debug/trace_event.h" |
+#include "base/json/json_writer.h" |
#include "base/stl_util.h" |
#include "cc/append_quads_data.h" |
#include "cc/damage_tracker.h" |
@@ -1552,6 +1553,17 @@ std::string LayerTreeHostImpl::layerTreeAsText() const |
return str; |
} |
+std::string LayerTreeHostImpl::layerTreeAsJson() const |
+{ |
+ std::string str; |
+ if (rootLayer()) { |
+ scoped_ptr<base::Value> json(rootLayer()->layerTreeAsJson()); |
+ base::JSONWriter::WriteWithOptions( |
+ json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); |
+ } |
+ return str; |
+} |
+ |
void LayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const LayerImpl* layer) const |
{ |
if (layer->renderSurface()) |