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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 transform_is_invertible_(true), | 64 transform_is_invertible_(true), |
65 is_container_for_fixed_position_layers_(false), | 65 is_container_for_fixed_position_layers_(false), |
66 background_color_(0), | 66 background_color_(0), |
67 opacity_(1.0), | 67 opacity_(1.0), |
68 blend_mode_(SkXfermode::kSrcOver_Mode), | 68 blend_mode_(SkXfermode::kSrcOver_Mode), |
69 num_descendants_that_draw_content_(0), | 69 num_descendants_that_draw_content_(0), |
70 draw_depth_(0.f), | 70 draw_depth_(0.f), |
71 needs_push_properties_(false), | 71 needs_push_properties_(false), |
72 num_dependents_need_push_properties_(0), | 72 num_dependents_need_push_properties_(0), |
73 sorting_context_id_(0), | 73 sorting_context_id_(0), |
74 current_draw_mode_(DRAW_MODE_NONE) { | 74 current_draw_mode_(DRAW_MODE_NONE), |
75 frame_timing_requests_dirty_(false) { | |
75 DCHECK_GT(layer_id_, 0); | 76 DCHECK_GT(layer_id_, 0); |
76 DCHECK(layer_tree_impl_); | 77 DCHECK(layer_tree_impl_); |
77 layer_tree_impl_->RegisterLayer(this); | 78 layer_tree_impl_->RegisterLayer(this); |
78 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); | 79 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); |
79 layer_animation_controller_ = | 80 layer_animation_controller_ = |
80 registrar->GetAnimationControllerForId(layer_id_); | 81 registrar->GetAnimationControllerForId(layer_id_); |
81 layer_animation_controller_->AddValueObserver(this); | 82 layer_animation_controller_->AddValueObserver(this); |
82 if (IsActive()) { | 83 if (IsActive()) { |
83 layer_animation_controller_->set_value_provider(this); | 84 layer_animation_controller_->set_value_provider(this); |
84 layer_animation_controller_->set_layer_animation_delegate(this); | 85 layer_animation_controller_->set_layer_animation_delegate(this); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
606 // If the main thread commits multiple times before the impl thread actually | 607 // If the main thread commits multiple times before the impl thread actually |
607 // draws, then damage tracking will become incorrect if we simply clobber the | 608 // draws, then damage tracking will become incorrect if we simply clobber the |
608 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 609 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
609 // union) any update changes that have occurred on the main thread. | 610 // union) any update changes that have occurred on the main thread. |
610 update_rect_.Union(layer->update_rect()); | 611 update_rect_.Union(layer->update_rect()); |
611 layer->SetUpdateRect(update_rect_); | 612 layer->SetUpdateRect(update_rect_); |
612 | 613 |
613 layer->SetStackingOrderChanged(stacking_order_changed_); | 614 layer->SetStackingOrderChanged(stacking_order_changed_); |
614 layer->SetDebugInfo(debug_info_); | 615 layer->SetDebugInfo(debug_info_); |
615 | 616 |
617 if (frame_timing_requests_dirty_) { | |
618 layer->SetFrameTimingRequests(frame_timing_requests_); | |
619 frame_timing_requests_dirty_ = false; | |
620 } | |
621 | |
616 // Reset any state that should be cleared for the next update. | 622 // Reset any state that should be cleared for the next update. |
617 stacking_order_changed_ = false; | 623 stacking_order_changed_ = false; |
618 update_rect_ = gfx::Rect(); | 624 update_rect_ = gfx::Rect(); |
619 needs_push_properties_ = false; | 625 needs_push_properties_ = false; |
620 num_dependents_need_push_properties_ = 0; | 626 num_dependents_need_push_properties_ = 0; |
621 } | 627 } |
622 | 628 |
623 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { | 629 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { |
624 if (!scroll_clip_layer_) | 630 if (!scroll_clip_layer_) |
625 return gfx::Vector2dF(); | 631 return gfx::Vector2dF(); |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1570 debug_info_value->GetAsDictionary(&dictionary_value); | 1576 debug_info_value->GetAsDictionary(&dictionary_value); |
1571 DCHECK(converted_to_dictionary); | 1577 DCHECK(converted_to_dictionary); |
1572 for (base::DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd(); | 1578 for (base::DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd(); |
1573 it.Advance()) { | 1579 it.Advance()) { |
1574 state->SetValue(it.key().data(), it.value().DeepCopy()); | 1580 state->SetValue(it.key().data(), it.value().DeepCopy()); |
1575 } | 1581 } |
1576 } else { | 1582 } else { |
1577 NOTREACHED(); | 1583 NOTREACHED(); |
1578 } | 1584 } |
1579 } | 1585 } |
1586 | |
1587 if (!frame_timing_requests_.empty()) { | |
1588 state->BeginArray("frame_timing_requests"); | |
1589 for (const auto& request : frame_timing_requests_) { | |
1590 state->BeginDictionary(); | |
1591 state->SetInteger("request_id", request.id()); | |
1592 state->BeginArray("request_rect"); | |
1593 MathUtil::AddToTracedValue(request.rect(), state); | |
1594 state->EndArray(); | |
1595 state->EndDictionary(); | |
1596 } | |
1597 state->EndArray(); | |
1598 } | |
1580 } | 1599 } |
1581 | 1600 |
1582 bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const { | 1601 bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const { |
1583 return draw_properties_.last_drawn_render_surface_layer_list_id == | 1602 return draw_properties_.last_drawn_render_surface_layer_list_id == |
1584 layer_tree_impl_->current_render_surface_list_id(); | 1603 layer_tree_impl_->current_render_surface_list_id(); |
1585 } | 1604 } |
1586 | 1605 |
1587 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1606 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1588 | 1607 |
1589 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1608 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
(...skipping 18 matching lines...) Expand all Loading... | |
1608 | 1627 |
1609 SetNeedsPushProperties(); | 1628 SetNeedsPushProperties(); |
1610 layer_tree_impl()->set_needs_update_draw_properties(); | 1629 layer_tree_impl()->set_needs_update_draw_properties(); |
1611 if (should_have_render_surface) { | 1630 if (should_have_render_surface) { |
1612 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); | 1631 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); |
1613 return; | 1632 return; |
1614 } | 1633 } |
1615 render_surface_.reset(); | 1634 render_surface_.reset(); |
1616 } | 1635 } |
1617 | 1636 |
1637 void LayerImpl::SetFrameTimingRequests( | |
danakj
2015/01/23 18:08:45
same order as in the header please
vmpstr
2015/01/23 18:41:57
Done.
| |
1638 const std::vector<FrameTimingRequest>& requests) { | |
1639 frame_timing_requests_ = requests; | |
1640 frame_timing_requests_dirty_ = true; | |
1641 SetNeedsPushProperties(); | |
1642 } | |
1643 | |
1618 } // namespace cc | 1644 } // namespace cc |
OLD | NEW |