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

Unified Diff: cc/layer_impl.cc

Issue 11446076: Added LayerTreeHostImpl::layerTreeAsJson which serializes a layer tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index c9c41c17f34a8f32f42069d00e25468ad082ab5e..55f49ba69a01d053a97b2b30496827313b8978c5 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -6,6 +6,7 @@
#include "base/debug/trace_event.h"
#include "base/stringprintf.h"
+#include "base/values.h"
#include "cc/debug_border_draw_quad.h"
#include "cc/debug_colors.h"
#include "cc/layer_tree_host_impl.h"
@@ -347,6 +348,41 @@ void LayerImpl::dumpLayer(std::string* str, int indent) const
m_children[i]->dumpLayer(str, indent+1);
}
+base::DictionaryValue* LayerImpl::layerTreeAsJson() const
+{
+ base::ListValue* list;
+ base::DictionaryValue* result = new base::DictionaryValue;
+ result->SetString("LayerType", layerTypeAsString());
+
+ list = new base::ListValue;
+ list->AppendInteger(bounds().width());
+ list->AppendInteger(bounds().height());
+ result->Set("Bounds", list);
+
+ list = new base::ListValue;
+ list->AppendDouble(m_position.x());
+ list->AppendDouble(m_position.y());
+ result->Set("Position", list);
+
+ const gfx::Transform& gfxTransform = m_drawProperties.target_space_transform;
+ double transform[16];
+ gfxTransform.matrix().asColMajord(transform);
+ list = new base::ListValue;
+ for (int i = 0; i < 16; ++i)
+ list->AppendDouble(transform[i]);
+ result->Set("DrawTransform", list);
+
+ result->SetBoolean("DrawsContent", m_drawsContent);
+ result->SetDouble("Opacity", opacity());
+
+ list = new base::ListValue;
+ for (size_t i = 0; i < m_children.size(); ++i)
+ list->Append(m_children[i]->layerTreeAsJson());
+ result->Set("Children", list);
+
+ return result;
+}
+
void LayerImpl::setStackingOrderChanged(bool stackingOrderChanged)
{
// We don't need to store this flag; we only need to track that the change occurred.
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698