diff options
-rw-r--r-- | cc/layer_impl.cc | 23 | ||||
-rw-r--r-- | cc/layer_impl.h | 5 | ||||
-rw-r--r-- | cc/layer_tree_host_impl.cc | 1 | ||||
-rw-r--r-- | cc/layer_tree_impl.cc | 16 | ||||
-rw-r--r-- | cc/layer_tree_impl.h | 2 | ||||
-rw-r--r-- | cc/picture_layer_impl.cc | 9 | ||||
-rw-r--r-- | cc/picture_layer_impl.h | 2 | ||||
-rw-r--r-- | cc/picture_layer_tiling.cc | 9 | ||||
-rw-r--r-- | cc/picture_layer_tiling.h | 2 | ||||
-rw-r--r-- | cc/picture_layer_tiling_set.cc | 7 | ||||
-rw-r--r-- | cc/picture_layer_tiling_set.h | 2 |
11 files changed, 78 insertions, 0 deletions
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 @@ void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) 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 diff --git a/cc/layer_impl.h b/cc/layer_impl.h index 5e0e32d..c168964 100644 --- a/cc/layer_impl.h +++ b/cc/layer_impl.h @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "base/values.h" #include "cc/cc_export.h" #include "cc/draw_properties.h" #include "cc/input_handler.h" @@ -309,6 +310,8 @@ public: virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl*); virtual void pushPropertiesTo(LayerImpl*); + virtual scoped_ptr<base::Value> AsValue() const; + protected: LayerImpl(LayerTreeImpl* layerImpl, int); @@ -320,6 +323,8 @@ protected: virtual void dumpLayerProperties(std::string*, int indent) const; static std::string indentString(int indent); + void AsValueInto(base::DictionaryValue* dict) const; + private: void updateScrollbarPositions(); diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index 397a2d3..7d1d1bc 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -1736,6 +1736,7 @@ scoped_ptr<base::Value> LayerTreeHostImpl::frameStateAsValue() const state->Set("device_viewport_size", MathUtil::asValue(m_deviceViewportSize).release()); if (m_tileManager) state->Set("tiles", m_tileManager->AllTilesAsValue().release()); + state->Set("active_tree", activeTree()->AsValue().release()); return state.PassAs<base::Value>(); } diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc index b0d071e..08ccebc 100644 --- a/cc/layer_tree_impl.cc +++ b/cc/layer_tree_impl.cc @@ -472,4 +472,20 @@ AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { return layer_tree_host_impl_->animationRegistrar(); } +scoped_ptr<base::Value> LayerTreeImpl::AsValue() const { + scoped_ptr<base::ListValue> state(new base::ListValue()); + typedef LayerIterator<LayerImpl, + std::vector<LayerImpl*>, + RenderSurfaceImpl, + LayerIteratorActions::BackToFront> LayerIteratorType; + LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_); + for (LayerIteratorType it = LayerIteratorType::begin( + &render_surface_layer_list_); it != end; ++it) { + if (!it.representsItself()) + continue; + state->Append((*it)->AsValue().release()); + } + return state.PassAs<base::Value>(); +} + } // namespace cc diff --git a/cc/layer_tree_impl.h b/cc/layer_tree_impl.h index 729c3d45..ee2b6df 100644 --- a/cc/layer_tree_impl.h +++ b/cc/layer_tree_impl.h @@ -6,6 +6,7 @@ #define CC_LAYER_TREE_IMPL_H_ #include "base/hash_tables.h" +#include "base/values.h" #include "cc/layer_impl.h" #if defined(COMPILER_GCC) @@ -77,6 +78,7 @@ class CC_EXPORT LayerTreeImpl { const gfx::Size& layout_viewport_size() const; std::string layer_tree_as_text() const; DebugRectHistory* debug_rect_history() const; + scoped_ptr<base::Value> AsValue() const; // Other public methods // --------------------------------------------------------------------------- diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc index 1975856..f6d9297 100644 --- a/cc/picture_layer_impl.cc +++ b/cc/picture_layer_impl.cc @@ -746,4 +746,13 @@ void PictureLayerImpl::getDebugBorderProperties( *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); } +scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { + scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); + LayerImpl::AsValueInto(state.get()); + + state->SetDouble("ideal_contents_scale", ideal_contents_scale_); + state->Set("tilings", tilings_->AsValue().release()); + return state.PassAs<base::Value>(); +} + } // namespace cc diff --git a/cc/picture_layer_impl.h b/cc/picture_layer_impl.h index cc511a1..9808720 100644 --- a/cc/picture_layer_impl.h +++ b/cc/picture_layer_impl.h @@ -68,6 +68,8 @@ public: virtual bool areVisibleResourcesReady() const OVERRIDE; + virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; + protected: PictureLayerImpl(LayerTreeImpl* treeImpl, int id); PictureLayerTiling* AddTiling(float contents_scale); diff --git a/cc/picture_layer_tiling.cc b/cc/picture_layer_tiling.cc index 2758dd7..95be306 100644 --- a/cc/picture_layer_tiling.cc +++ b/cc/picture_layer_tiling.cc @@ -530,4 +530,13 @@ void PictureLayerTiling::DidBecomeActive() { } } +scoped_ptr<base::Value> PictureLayerTiling::AsValue() const { + scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); + state->SetInteger("num_tiles", tiles_.size()); + state->SetDouble("content_scale", contents_scale_); + state->Set("content_bounds", + MathUtil::asValue(ContentRect().size()).release()); + return state.PassAs<base::Value>(); +} + } // namespace cc diff --git a/cc/picture_layer_tiling.h b/cc/picture_layer_tiling.h index deec32aa..bf504b8 100644 --- a/cc/picture_layer_tiling.h +++ b/cc/picture_layer_tiling.h @@ -144,6 +144,8 @@ class CC_EXPORT PictureLayerTiling { // also updates the pile on each tile to be the current client's pile. void DidBecomeActive(); + scoped_ptr<base::Value> AsValue() const; + protected: typedef std::pair<int, int> TileMapKey; typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; diff --git a/cc/picture_layer_tiling_set.cc b/cc/picture_layer_tiling_set.cc index 52414e4..c20f064 100644 --- a/cc/picture_layer_tiling_set.cc +++ b/cc/picture_layer_tiling_set.cc @@ -300,4 +300,11 @@ void PictureLayerTilingSet::DidBecomeActive() { tilings_[i]->DidBecomeActive(); } +scoped_ptr<base::Value> PictureLayerTilingSet::AsValue() const { + scoped_ptr<base::ListValue> state(new base::ListValue()); + for (size_t i = 0; i < tilings_.size(); ++i) + state->Append(tilings_[i]->AsValue().release()); + return state.PassAs<base::Value>(); +} + } // namespace cc diff --git a/cc/picture_layer_tiling_set.h b/cc/picture_layer_tiling_set.h index de8c390..dc0b35e 100644 --- a/cc/picture_layer_tiling_set.h +++ b/cc/picture_layer_tiling_set.h @@ -111,6 +111,8 @@ class CC_EXPORT PictureLayerTilingSet { Region::Iterator region_iter_; }; + scoped_ptr<base::Value> AsValue() const; + private: PictureLayerTilingClient* client_; gfx::Size layer_bounds_; |