OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/debug/trace_event_argument.h" | 8 #include "base/debug/trace_event_argument.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 } | 1459 } |
1460 | 1460 |
1461 void LayerImpl::AsValueInto(base::debug::TracedValue* state) const { | 1461 void LayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
1462 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 1462 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
1463 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 1463 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
1464 state, | 1464 state, |
1465 "cc::LayerImpl", | 1465 "cc::LayerImpl", |
1466 LayerTypeAsString(), | 1466 LayerTypeAsString(), |
1467 this); | 1467 this); |
1468 state->SetInteger("layer_id", id()); | 1468 state->SetInteger("layer_id", id()); |
1469 state->BeginDictionary("bounds"); | 1469 MathUtil::AddToTracedValue("bounds", bounds_, state); |
1470 MathUtil::AddToTracedValue(bounds_, state); | |
1471 state->EndDictionary(); | |
1472 | 1470 |
1473 state->SetDouble("opacity", opacity()); | 1471 state->SetDouble("opacity", opacity()); |
1474 | 1472 |
1475 state->BeginArray("position"); | 1473 MathUtil::AddToTracedValue("position", position_, state); |
1476 MathUtil::AddToTracedValue(position_, state); | |
1477 state->EndArray(); | |
1478 | 1474 |
1479 state->SetInteger("draws_content", DrawsContent()); | 1475 state->SetInteger("draws_content", DrawsContent()); |
1480 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 1476 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
1481 | 1477 |
1482 state->BeginArray("scroll_offset"); | 1478 MathUtil::AddToTracedValue("scroll_offset", scroll_offset_, state); |
1483 MathUtil::AddToTracedValue(scroll_offset_, state); | 1479 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state); |
1484 state->EndArray(); | |
1485 | |
1486 state->BeginArray("transform_origin"); | |
1487 MathUtil::AddToTracedValue(transform_origin_, state); | |
1488 state->EndArray(); | |
1489 | 1480 |
1490 bool clipped; | 1481 bool clipped; |
1491 gfx::QuadF layer_quad = MathUtil::MapQuad( | 1482 gfx::QuadF layer_quad = MathUtil::MapQuad( |
1492 screen_space_transform(), | 1483 screen_space_transform(), |
1493 gfx::QuadF(gfx::Rect(content_bounds())), | 1484 gfx::QuadF(gfx::Rect(content_bounds())), |
1494 &clipped); | 1485 &clipped); |
1495 state->BeginArray("layer_quad"); | 1486 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); |
1496 MathUtil::AddToTracedValue(layer_quad, state); | |
1497 state->EndArray(); | |
1498 if (!touch_event_handler_region_.IsEmpty()) { | 1487 if (!touch_event_handler_region_.IsEmpty()) { |
1499 state->BeginArray("touch_event_handler_region"); | 1488 state->BeginArray("touch_event_handler_region"); |
1500 touch_event_handler_region_.AsValueInto(state); | 1489 touch_event_handler_region_.AsValueInto(state); |
1501 state->EndArray(); | 1490 state->EndArray(); |
1502 } | 1491 } |
1503 if (have_wheel_event_handlers_) { | 1492 if (have_wheel_event_handlers_) { |
1504 gfx::Rect wheel_rect(content_bounds()); | 1493 gfx::Rect wheel_rect(content_bounds()); |
1505 Region wheel_region(wheel_rect); | 1494 Region wheel_region(wheel_rect); |
1506 state->BeginArray("wheel_event_handler_region"); | 1495 state->BeginArray("wheel_event_handler_region"); |
1507 wheel_region.AsValueInto(state); | 1496 wheel_region.AsValueInto(state); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 state->SetInteger("clip_parent", clip_parent_->id()); | 1534 state->SetInteger("clip_parent", clip_parent_->id()); |
1546 | 1535 |
1547 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); | 1536 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); |
1548 state->SetBoolean("contents_opaque", contents_opaque()); | 1537 state->SetBoolean("contents_opaque", contents_opaque()); |
1549 | 1538 |
1550 state->SetBoolean( | 1539 state->SetBoolean( |
1551 "has_animation_bounds", | 1540 "has_animation_bounds", |
1552 layer_animation_controller()->HasAnimationThatInflatesBounds()); | 1541 layer_animation_controller()->HasAnimationThatInflatesBounds()); |
1553 | 1542 |
1554 gfx::BoxF box; | 1543 gfx::BoxF box; |
1555 if (LayerUtils::GetAnimationBounds(*this, &box)) { | 1544 if (LayerUtils::GetAnimationBounds(*this, &box)) |
1556 state->BeginArray("animation_bounds"); | 1545 MathUtil::AddToTracedValue("animation_bounds", box, state); |
1557 MathUtil::AddToTracedValue(box, state); | |
1558 state->EndArray(); | |
1559 } | |
1560 | 1546 |
1561 if (debug_info_.get()) { | 1547 if (debug_info_.get()) { |
1562 std::string str; | 1548 std::string str; |
1563 debug_info_->AppendAsTraceFormat(&str); | 1549 debug_info_->AppendAsTraceFormat(&str); |
1564 base::JSONReader json_reader; | 1550 base::JSONReader json_reader; |
1565 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); | 1551 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); |
1566 | 1552 |
1567 if (debug_info_value->IsType(base::Value::TYPE_DICTIONARY)) { | 1553 if (debug_info_value->IsType(base::Value::TYPE_DICTIONARY)) { |
1568 base::DictionaryValue* dictionary_value = nullptr; | 1554 base::DictionaryValue* dictionary_value = nullptr; |
1569 bool converted_to_dictionary = | 1555 bool converted_to_dictionary = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 SetNeedsPushProperties(); | 1595 SetNeedsPushProperties(); |
1610 layer_tree_impl()->set_needs_update_draw_properties(); | 1596 layer_tree_impl()->set_needs_update_draw_properties(); |
1611 if (should_have_render_surface) { | 1597 if (should_have_render_surface) { |
1612 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); | 1598 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); |
1613 return; | 1599 return; |
1614 } | 1600 } |
1615 render_surface_.reset(); | 1601 render_surface_.reset(); |
1616 } | 1602 } |
1617 | 1603 |
1618 } // namespace cc | 1604 } // namespace cc |
OLD | NEW |