Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index b6a4120eb63c39bc0dd770137d9e6c3004d5d507..68b272168dfbb108cfa68b4436d1a88b480b2a90 100644 |
--- a/cc/layers/layer_impl.cc |
+++ b/cc/layers/layer_impl.cc |
@@ -54,6 +54,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) |
force_render_surface_(false), |
is_container_for_fixed_position_layers_(false), |
draw_depth_(0.f), |
+ compositing_reasons_(kCompositingReasonUnknown), |
#ifndef NDEBUG |
between_will_draw_and_did_draw_(false), |
#endif |
@@ -352,6 +353,7 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) { |
layer->SetContentBounds(content_bounds()); |
layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
layer->SetDebugName(debug_name_); |
+ layer->SetCompositingReasons(compositing_reasons_); |
layer->SetDoubleSided(double_sided_); |
layer->SetDrawCheckerboardForMissingTiles( |
draw_checkerboard_for_missing_tiles_); |
@@ -1001,12 +1003,134 @@ void LayerImpl::SetVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbar_layer) { |
vertical_scrollbar_layer_->set_scroll_layer_id(id()); |
} |
+scoped_ptr<base::Value> |
+CompositingReasonsAsValue(CompositingReasons reasons) { |
danakj
2013/05/25 13:34:00
Is this method supposed to be static? Maybe it sho
shawnsingh
2013/05/28 07:20:49
For the sake of landing, I'm making it static but
|
+ scoped_ptr<base::ListValue> reason_list(new base::ListValue()); |
+ |
+ if (reasons == kCompositingReasonUnknown) { |
+ reason_list->AppendString("No reasons given"); |
+ return reason_list.PassAs<base::Value>(); |
+ } |
+ |
+ if (reasons & kCompositingReason3DTransform) |
+ reason_list->AppendString("Has a 3d Transform"); |
+ |
+ if (reasons & kCompositingReasonVideo) |
+ reason_list->AppendString("Is accelerated video"); |
+ |
+ if (reasons & kCompositingReasonCanvas) |
+ reason_list->AppendString("Is accelerated canvas"); |
+ |
+ if (reasons & kCompositingReasonPlugin) |
+ reason_list->AppendString("Is accelerated plugin"); |
+ |
+ if (reasons & kCompositingReasonIFrame) |
+ reason_list->AppendString("Is accelerated iframe"); |
+ |
+ if (reasons & kCompositingReasonBackfaceVisibilityHidden) |
+ reason_list->AppendString("Has backface-visibility: hidden"); |
+ |
+ if (reasons & kCompositingReasonAnimation) |
+ reason_list->AppendString("Has accelerated animation or transition"); |
+ |
+ if (reasons & kCompositingReasonFilters) |
+ reason_list->AppendString("Has accelerated filters"); |
+ |
+ if (reasons & kCompositingReasonPositionFixed) |
+ reason_list->AppendString("Is fixed position"); |
+ |
+ if (reasons & kCompositingReasonPositionSticky) |
+ reason_list->AppendString("Is sticky position"); |
+ |
+ if (reasons & kCompositingReasonOverflowScrollingTouch) |
+ reason_list->AppendString("Is a scrollable overflow element"); |
+ |
+ if (reasons & kCompositingReasonBlending) |
+ reason_list->AppendString("Has a blend mode"); |
+ |
+ if (reasons & kCompositingReasonAssumedOverlap) |
+ reason_list->AppendString("Might overlap a composited animation"); |
+ |
+ if (reasons & kCompositingReasonOverlap) |
+ reason_list->AppendString("Overlaps other composited content"); |
+ |
+ if (reasons & kCompositingReasonNegativeZIndexChildren) { |
+ reason_list->AppendString("Might overlap negative z-index " |
+ "composited content"); |
+ } |
+ |
+ if (reasons & kCompositingReasonTransformWithCompositedDescendants) { |
+ reason_list->AppendString("Has transform needed by a " |
+ "composited descendant"); |
+ } |
+ |
+ if (reasons & kCompositingReasonOpacityWithCompositedDescendants) |
+ reason_list->AppendString("Has opacity needed by a composited descendant"); |
+ |
+ if (reasons & kCompositingReasonMaskWithCompositedDescendants) |
+ reason_list->AppendString("Has a mask needed by a composited descendant"); |
+ |
+ if (reasons & kCompositingReasonReflectionWithCompositedDescendants) |
+ reason_list->AppendString("Has a reflection with a composited descendant"); |
+ |
+ if (reasons & kCompositingReasonFilterWithCompositedDescendants) |
+ reason_list->AppendString("Has filter effect with a composited descendant"); |
+ |
+ if (reasons & kCompositingReasonBlendingWithCompositedDescendants) |
+ reason_list->AppendString("Has a blend mode with a composited descendant"); |
+ |
+ if (reasons & kCompositingReasonClipsCompositingDescendants) |
+ reason_list->AppendString("Clips a composited descendant"); |
+ |
+ if (reasons & kCompositingReasonPerspective) { |
+ reason_list->AppendString("Has a perspective transform needed by a " |
+ "composited 3d descendant"); |
+ } |
+ |
+ if (reasons & kCompositingReasonPreserve3D) { |
+ reason_list->AppendString("Has preserves-3d style with composited " |
+ "3d descendant"); |
+ } |
+ |
+ if (reasons & kCompositingReasonReflectionOfCompositedParent) |
+ reason_list->AppendString("Is the reflection of a composited layer"); |
+ |
+ if (reasons & kCompositingReasonRoot) |
+ reason_list->AppendString("Is the root"); |
+ |
+ if (reasons & kCompositingReasonLayerForClip) |
+ reason_list->AppendString("Convenience layer, to clip subtree"); |
+ |
+ if (reasons & kCompositingReasonLayerForScrollbar) |
+ reason_list->AppendString("Convenience layer for rendering scrollbar"); |
+ |
+ if (reasons & kCompositingReasonLayerForScrollingContainer) |
+ reason_list->AppendString("Convenience layer, the scrolling container"); |
+ |
+ if (reasons & kCompositingReasonLayerForForeground) { |
+ reason_list->AppendString("Convenience layer, foreground when main layer " |
+ "has negative z-index composited content"); |
+ } |
+ |
+ if (reasons & kCompositingReasonLayerForBackground) { |
+ reason_list->AppendString("Convenience layer, background when main layer " |
+ "has a composited background"); |
+ } |
+ |
+ if (reasons & kCompositingReasonLayerForMask) |
+ reason_list->AppendString("Is a mask layer"); |
+ |
+ return reason_list.PassAs<base::Value>(); |
+} |
+ |
void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); |
state->SetInteger("layer_id", id()); |
state->Set("bounds", MathUtil::AsValue(bounds()).release()); |
state->SetInteger("draws_content", DrawsContent()); |
state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
+ state->Set("compositing_reasons", |
+ CompositingReasonsAsValue(compositing_reasons_).release()); |
bool clipped; |
gfx::QuadF layer_quad = MathUtil::MapQuad( |