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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
9 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
10 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
11 #include "cc/animation/animation_registrar.h" 10 #include "cc/animation/animation_registrar.h"
12 #include "cc/animation/scrollbar_animation_controller.h" 11 #include "cc/animation/scrollbar_animation_controller.h"
13 #include "cc/base/math_util.h" 12 #include "cc/base/math_util.h"
14 #include "cc/debug/debug_colors.h" 13 #include "cc/debug/debug_colors.h"
15 #include "cc/debug/layer_tree_debug_state.h" 14 #include "cc/debug/layer_tree_debug_state.h"
16 #include "cc/debug/micro_benchmark_impl.h" 15 #include "cc/debug/micro_benchmark_impl.h"
17 #include "cc/debug/traced_value.h" 16 #include "cc/debug/traced_value.h"
18 #include "cc/input/layer_scroll_offset_delegate.h" 17 #include "cc/input/layer_scroll_offset_delegate.h"
(...skipping 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 } 1383 }
1385 1384
1386 void LayerImpl::RemoveDependentNeedsPushProperties() { 1385 void LayerImpl::RemoveDependentNeedsPushProperties() {
1387 num_dependents_need_push_properties_--; 1386 num_dependents_need_push_properties_--;
1388 DCHECK_GE(num_dependents_need_push_properties_, 0); 1387 DCHECK_GE(num_dependents_need_push_properties_, 0);
1389 1388
1390 if (!parent_should_know_need_push_properties() && parent_) 1389 if (!parent_should_know_need_push_properties() && parent_)
1391 parent_->RemoveDependentNeedsPushProperties(); 1390 parent_->RemoveDependentNeedsPushProperties();
1392 } 1391 }
1393 1392
1394 void LayerImpl::AsValueInto(base::debug::TracedValue* state) const { 1393 void LayerImpl::AsValueInto(base::DictionaryValue* state) const {
1395 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( 1394 TracedValue::MakeDictIntoImplicitSnapshotWithCategory(
1396 TRACE_DISABLED_BY_DEFAULT("cc.debug"), 1395 TRACE_DISABLED_BY_DEFAULT("cc.debug"),
1397 state, 1396 state,
1398 "cc::LayerImpl", 1397 "cc::LayerImpl",
1399 LayerTypeAsString(), 1398 LayerTypeAsString(),
1400 this); 1399 this);
1401 state->SetInteger("layer_id", id()); 1400 state->SetInteger("layer_id", id());
1402 state->BeginDictionary("bounds"); 1401 state->Set("bounds", MathUtil::AsValue(bounds_).release());
1403 MathUtil::AddToTracedValue(bounds_, state); 1402 state->Set("position", MathUtil::AsValue(position_).release());
1404 state->EndDictionary();
1405
1406 state->BeginArray("position");
1407 MathUtil::AddToTracedValue(position_, state);
1408 state->EndArray();
1409
1410 state->SetInteger("draws_content", DrawsContent()); 1403 state->SetInteger("draws_content", DrawsContent());
1411 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); 1404 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes());
1412 1405 state->Set("scroll_offset", MathUtil::AsValue(scroll_offset_).release());
1413 state->BeginArray("scroll_offset"); 1406 state->Set("transform_origin",
1414 MathUtil::AddToTracedValue(scroll_offset_, state); 1407 MathUtil::AsValue(transform_origin_).release());
1415 state->EndArray();
1416
1417 state->BeginArray("transform_origin");
1418 MathUtil::AddToTracedValue(transform_origin_, state);
1419 state->EndArray();
1420 1408
1421 bool clipped; 1409 bool clipped;
1422 gfx::QuadF layer_quad = MathUtil::MapQuad( 1410 gfx::QuadF layer_quad = MathUtil::MapQuad(
1423 screen_space_transform(), 1411 screen_space_transform(),
1424 gfx::QuadF(gfx::Rect(content_bounds())), 1412 gfx::QuadF(gfx::Rect(content_bounds())),
1425 &clipped); 1413 &clipped);
1426 state->BeginArray("layer_quad"); 1414 state->Set("layer_quad", MathUtil::AsValue(layer_quad).release());
1427 MathUtil::AddToTracedValue(layer_quad, state); 1415
1428 state->EndArray();
1429 if (!touch_event_handler_region_.IsEmpty()) { 1416 if (!touch_event_handler_region_.IsEmpty()) {
1430 state->BeginArray("touch_event_handler_region"); 1417 state->Set("touch_event_handler_region",
1431 touch_event_handler_region_.AsValueInto(state); 1418 touch_event_handler_region_.AsValue().release());
1432 state->EndArray();
1433 } 1419 }
1434 if (have_wheel_event_handlers_) { 1420 if (have_wheel_event_handlers_) {
1435 gfx::Rect wheel_rect(content_bounds()); 1421 gfx::Rect wheel_rect(content_bounds());
1436 Region wheel_region(wheel_rect); 1422 Region wheel_region(wheel_rect);
1437 state->BeginArray("wheel_event_handler_region"); 1423 state->Set("wheel_event_handler_region",
1438 wheel_region.AsValueInto(state); 1424 wheel_region.AsValue().release());
1439 state->EndArray();
1440 } 1425 }
1441 if (have_scroll_event_handlers_) { 1426 if (have_scroll_event_handlers_) {
1442 gfx::Rect scroll_rect(content_bounds()); 1427 gfx::Rect scroll_rect(content_bounds());
1443 Region scroll_region(scroll_rect); 1428 Region scroll_region(scroll_rect);
1444 state->BeginArray("scroll_event_handler_region"); 1429 state->Set("scroll_event_handler_region",
1445 scroll_region.AsValueInto(state); 1430 scroll_region.AsValue().release());
1446 state->EndArray();
1447 } 1431 }
1448 if (!non_fast_scrollable_region_.IsEmpty()) { 1432 if (!non_fast_scrollable_region_.IsEmpty()) {
1449 state->BeginArray("non_fast_scrollable_region"); 1433 state->Set("non_fast_scrollable_region",
1450 non_fast_scrollable_region_.AsValueInto(state); 1434 non_fast_scrollable_region_.AsValue().release());
1451 state->EndArray();
1452 } 1435 }
1453 1436
1454 state->BeginArray("children"); 1437 scoped_ptr<base::ListValue> children_list(new base::ListValue());
1455 for (size_t i = 0; i < children_.size(); ++i) { 1438 for (size_t i = 0; i < children_.size(); ++i)
1456 state->BeginDictionary(); 1439 children_list->Append(children_[i]->AsValue().release());
1457 children_[i]->AsValueInto(state); 1440 state->Set("children", children_list.release());
1458 state->EndDictionary(); 1441 if (mask_layer_)
1459 } 1442 state->Set("mask_layer", mask_layer_->AsValue().release());
1460 state->EndArray(); 1443 if (replica_layer_)
1461 if (mask_layer_) { 1444 state->Set("replica_layer", replica_layer_->AsValue().release());
1462 state->BeginDictionary("mask_layer");
1463 mask_layer_->AsValueInto(state);
1464 state->EndDictionary();
1465 }
1466 if (replica_layer_) {
1467 state->BeginDictionary("replica_layer");
1468 replica_layer_->AsValueInto(state);
1469 state->EndDictionary();
1470 }
1471 1445
1472 if (scroll_parent_) 1446 if (scroll_parent_)
1473 state->SetInteger("scroll_parent", scroll_parent_->id()); 1447 state->SetInteger("scroll_parent", scroll_parent_->id());
1474 1448
1475 if (clip_parent_) 1449 if (clip_parent_)
1476 state->SetInteger("clip_parent", clip_parent_->id()); 1450 state->SetInteger("clip_parent", clip_parent_->id());
1477 1451
1478 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); 1452 state->SetBoolean("can_use_lcd_text", can_use_lcd_text());
1479 state->SetBoolean("contents_opaque", contents_opaque()); 1453 state->SetBoolean("contents_opaque", contents_opaque());
1480 1454
1481 state->SetBoolean( 1455 state->SetBoolean(
1482 "has_animation_bounds", 1456 "has_animation_bounds",
1483 layer_animation_controller()->HasAnimationThatInflatesBounds()); 1457 layer_animation_controller()->HasAnimationThatInflatesBounds());
1484 1458
1485 gfx::BoxF box; 1459 gfx::BoxF box;
1486 if (LayerUtils::GetAnimationBounds(*this, &box)) { 1460 if (LayerUtils::GetAnimationBounds(*this, &box))
1487 state->BeginArray("animation_bounds"); 1461 state->Set("animation_bounds", MathUtil::AsValue(box).release());
1488 MathUtil::AddToTracedValue(box, state);
1489 state->EndArray();
1490 }
1491 1462
1492 if (debug_info_.get()) { 1463 if (debug_info_.get()) {
1493 std::string str; 1464 std::string str;
1494 debug_info_->AppendAsTraceFormat(&str); 1465 debug_info_->AppendAsTraceFormat(&str);
1495 base::JSONReader json_reader; 1466 base::JSONReader json_reader;
1496 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str)); 1467 scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str));
1497 1468
1498 if (debug_info_value->IsType(base::Value::TYPE_DICTIONARY)) { 1469 if (debug_info_value->IsType(base::Value::TYPE_DICTIONARY)) {
1499 base::DictionaryValue* dictionary_value = NULL; 1470 base::DictionaryValue* dictionary_value = NULL;
1500 bool converted_to_dictionary = 1471 bool converted_to_dictionary =
1501 debug_info_value->GetAsDictionary(&dictionary_value); 1472 debug_info_value->GetAsDictionary(&dictionary_value);
1502 DCHECK(converted_to_dictionary); 1473 DCHECK(converted_to_dictionary);
1503 for (base::DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd(); 1474 state->MergeDictionary(dictionary_value);
1504 it.Advance()) {
1505 state->SetValue(it.key().data(), it.value().DeepCopy());
1506 }
1507 } else { 1475 } else {
1508 NOTREACHED(); 1476 NOTREACHED();
1509 } 1477 }
1510 } 1478 }
1511 } 1479 }
1512 1480
1513 bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const { 1481 bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const {
1514 return draw_properties_.last_drawn_render_surface_layer_list_id == 1482 return draw_properties_.last_drawn_render_surface_layer_list_id ==
1515 layer_tree_impl_->current_render_surface_list_id(); 1483 layer_tree_impl_->current_render_surface_list_id();
1516 } 1484 }
1517 1485
1518 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } 1486 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; }
1519 1487
1488 scoped_ptr<base::Value> LayerImpl::AsValue() const {
1489 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1490 AsValueInto(state.get());
1491 return state.PassAs<base::Value>();
1492 }
1493
1520 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1494 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1521 benchmark->RunOnLayer(this); 1495 benchmark->RunOnLayer(this);
1522 } 1496 }
1523 1497
1524 void LayerImpl::NotifyAnimationFinished( 1498 void LayerImpl::NotifyAnimationFinished(
1525 base::TimeTicks monotonic_time, 1499 base::TimeTicks monotonic_time,
1526 Animation::TargetProperty target_property) { 1500 Animation::TargetProperty target_property) {
1527 if (target_property == Animation::ScrollOffset) 1501 if (target_property == Animation::ScrollOffset)
1528 layer_tree_impl_->InputScrollAnimationFinished(); 1502 layer_tree_impl_->InputScrollAnimationFinished();
1529 } 1503 }
1530 1504
1531 } // namespace cc 1505 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698