cc: Add PictureLayerImpl::AsValue
This allows for information about contents scales and tilings to be recorded
for the frame viewer.
[email protected]
BUG=176413
Review URL: https://chromiumcodereview.appspot.com/12258044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182747 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 8545e42..7838cb1 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -20,6 +20,7 @@
#include "cc/scrollbar_animation_controller_linear_fade.h"
#include "cc/scrollbar_layer_impl.h"
#include "ui/gfx/point_conversions.h"
+#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect_conversions.h"
namespace cc {
@@ -969,4 +970,26 @@
m_verticalScrollbarLayer->setScrollLayerId(id());
}
+void LayerImpl::AsValueInto(base::DictionaryValue* dict) const
+{
+ dict->SetInteger("id", id());
+ dict->Set("bounds", MathUtil::asValue(bounds()).release());
+ dict->SetInteger("draws_content", drawsContent());
+
+ bool clipped;
+ gfx::QuadF layer_quad = MathUtil::mapQuad(
+ screenSpaceTransform(),
+ gfx::QuadF(gfx::Rect(contentBounds())),
+ clipped);
+ dict->Set("layer_quad", MathUtil::asValue(layer_quad).release());
+
+}
+
+scoped_ptr<base::Value> LayerImpl::AsValue() const
+{
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ AsValueInto(state.get());
+ return state.PassAs<base::Value>();
+}
+
} // namespace cc