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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer.cc » ('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" 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 transform_is_invertible_(true), 63 transform_is_invertible_(true),
64 is_container_for_fixed_position_layers_(false), 64 is_container_for_fixed_position_layers_(false),
65 background_color_(0), 65 background_color_(0),
66 opacity_(1.0), 66 opacity_(1.0),
67 blend_mode_(SkXfermode::kSrcOver_Mode), 67 blend_mode_(SkXfermode::kSrcOver_Mode),
68 num_descendants_that_draw_content_(0), 68 num_descendants_that_draw_content_(0),
69 draw_depth_(0.f), 69 draw_depth_(0.f),
70 needs_push_properties_(false), 70 needs_push_properties_(false),
71 num_dependents_need_push_properties_(0), 71 num_dependents_need_push_properties_(0),
72 sorting_context_id_(0), 72 sorting_context_id_(0),
73 current_draw_mode_(DRAW_MODE_NONE) { 73 current_draw_mode_(DRAW_MODE_NONE),
74 frame_timing_requests_dirty_(false) {
74 DCHECK_GT(layer_id_, 0); 75 DCHECK_GT(layer_id_, 0);
75 DCHECK(layer_tree_impl_); 76 DCHECK(layer_tree_impl_);
76 layer_tree_impl_->RegisterLayer(this); 77 layer_tree_impl_->RegisterLayer(this);
77 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); 78 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar();
78 layer_animation_controller_ = 79 layer_animation_controller_ =
79 registrar->GetAnimationControllerForId(layer_id_); 80 registrar->GetAnimationControllerForId(layer_id_);
80 layer_animation_controller_->AddValueObserver(this); 81 layer_animation_controller_->AddValueObserver(this);
81 if (IsActive()) { 82 if (IsActive()) {
82 layer_animation_controller_->set_value_provider(this); 83 layer_animation_controller_->set_value_provider(this);
83 layer_animation_controller_->set_layer_animation_delegate(this); 84 layer_animation_controller_->set_layer_animation_delegate(this);
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // If the main thread commits multiple times before the impl thread actually 601 // If the main thread commits multiple times before the impl thread actually
601 // draws, then damage tracking will become incorrect if we simply clobber the 602 // draws, then damage tracking will become incorrect if we simply clobber the
602 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 603 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
603 // union) any update changes that have occurred on the main thread. 604 // union) any update changes that have occurred on the main thread.
604 update_rect_.Union(layer->update_rect()); 605 update_rect_.Union(layer->update_rect());
605 layer->SetUpdateRect(update_rect_); 606 layer->SetUpdateRect(update_rect_);
606 607
607 layer->SetStackingOrderChanged(stacking_order_changed_); 608 layer->SetStackingOrderChanged(stacking_order_changed_);
608 layer->SetDebugInfo(debug_info_); 609 layer->SetDebugInfo(debug_info_);
609 610
611 if (frame_timing_requests_dirty_) {
612 layer->PassFrameTimingRequests(&frame_timing_requests_);
613 frame_timing_requests_dirty_ = false;
614 }
615
610 // Reset any state that should be cleared for the next update. 616 // Reset any state that should be cleared for the next update.
611 stacking_order_changed_ = false; 617 stacking_order_changed_ = false;
612 update_rect_ = gfx::Rect(); 618 update_rect_ = gfx::Rect();
613 needs_push_properties_ = false; 619 needs_push_properties_ = false;
614 num_dependents_need_push_properties_ = 0; 620 num_dependents_need_push_properties_ = 0;
615 } 621 }
616 622
617 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const { 623 gfx::Vector2dF LayerImpl::FixedContainerSizeDelta() const {
618 if (!scroll_clip_layer_) 624 if (!scroll_clip_layer_)
619 return gfx::Vector2dF(); 625 return gfx::Vector2dF();
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 NoteLayerPropertyChangedForSubtree(); 1023 NoteLayerPropertyChangedForSubtree();
1018 } 1024 }
1019 1025
1020 void LayerImpl::Set3dSortingContextId(int id) { 1026 void LayerImpl::Set3dSortingContextId(int id) {
1021 if (id == sorting_context_id_) 1027 if (id == sorting_context_id_)
1022 return; 1028 return;
1023 sorting_context_id_ = id; 1029 sorting_context_id_ = id;
1024 NoteLayerPropertyChangedForSubtree(); 1030 NoteLayerPropertyChangedForSubtree();
1025 } 1031 }
1026 1032
1033 void LayerImpl::PassFrameTimingRequests(
1034 std::vector<FrameTimingRequest>* requests) {
1035 frame_timing_requests_.swap(*requests);
1036 frame_timing_requests_dirty_ = true;
1037 SetNeedsPushProperties();
1038 }
1039
1027 void LayerImpl::SetTransform(const gfx::Transform& transform) { 1040 void LayerImpl::SetTransform(const gfx::Transform& transform) {
1028 if (transform_ == transform) 1041 if (transform_ == transform)
1029 return; 1042 return;
1030 1043
1031 transform_ = transform; 1044 transform_ = transform;
1032 transform_is_invertible_ = transform_.IsInvertible(); 1045 transform_is_invertible_ = transform_.IsInvertible();
1033 NoteLayerPropertyChangedForSubtree(); 1046 NoteLayerPropertyChangedForSubtree();
1034 } 1047 }
1035 1048
1036 void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform, 1049 void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform,
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 debug_info_value->GetAsDictionary(&dictionary_value); 1558 debug_info_value->GetAsDictionary(&dictionary_value);
1546 DCHECK(converted_to_dictionary); 1559 DCHECK(converted_to_dictionary);
1547 for (base::DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd(); 1560 for (base::DictionaryValue::Iterator it(*dictionary_value); !it.IsAtEnd();
1548 it.Advance()) { 1561 it.Advance()) {
1549 state->SetValue(it.key().data(), it.value().DeepCopy()); 1562 state->SetValue(it.key().data(), it.value().DeepCopy());
1550 } 1563 }
1551 } else { 1564 } else {
1552 NOTREACHED(); 1565 NOTREACHED();
1553 } 1566 }
1554 } 1567 }
1568
1569 if (!frame_timing_requests_.empty()) {
1570 state->BeginArray("frame_timing_requests");
1571 for (const auto& request : frame_timing_requests_) {
1572 state->BeginDictionary();
1573 state->SetInteger("request_id", request.id());
1574 MathUtil::AddToTracedValue("request_rect", request.rect(), state);
1575 state->EndDictionary();
1576 }
1577 state->EndArray();
1578 }
1555 } 1579 }
1556 1580
1557 bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const { 1581 bool LayerImpl::IsDrawnRenderSurfaceLayerListMember() const {
1558 return draw_properties_.last_drawn_render_surface_layer_list_id == 1582 return draw_properties_.last_drawn_render_surface_layer_list_id ==
1559 layer_tree_impl_->current_render_surface_list_id(); 1583 layer_tree_impl_->current_render_surface_list_id();
1560 } 1584 }
1561 1585
1562 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } 1586 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; }
1563 1587
1564 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1588 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
(...skipping 19 matching lines...) Expand all
1584 SetNeedsPushProperties(); 1608 SetNeedsPushProperties();
1585 layer_tree_impl()->set_needs_update_draw_properties(); 1609 layer_tree_impl()->set_needs_update_draw_properties();
1586 if (should_have_render_surface) { 1610 if (should_have_render_surface) {
1587 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); 1611 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this));
1588 return; 1612 return;
1589 } 1613 }
1590 render_surface_.reset(); 1614 render_surface_.reset();
1591 } 1615 }
1592 1616
1593 } // namespace cc 1617 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698