| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 void LayerTreeHost::SetAnimationEvents( | 551 void LayerTreeHost::SetAnimationEvents( |
| 552 scoped_ptr<AnimationEventsVector> events) { | 552 scoped_ptr<AnimationEventsVector> events) { |
| 553 DCHECK(proxy_->IsMainThread()); | 553 DCHECK(proxy_->IsMainThread()); |
| 554 for (size_t event_index = 0; event_index < events->size(); ++event_index) { | 554 for (size_t event_index = 0; event_index < events->size(); ++event_index) { |
| 555 int event_layer_id = (*events)[event_index].layer_id; | 555 int event_layer_id = (*events)[event_index].layer_id; |
| 556 | 556 |
| 557 // Use the map of all controllers, not just active ones, since non-active | 557 // Use the map of all controllers, not just active ones, since non-active |
| 558 // controllers may still receive events for impl-only animations. | 558 // controllers may still receive events for impl-only animations. |
| 559 const AnimationRegistrar::AnimationControllerMap& animation_controllers = | 559 const AnimationRegistrar::AnimationControllerMap& animation_controllers = |
| 560 animation_registrar_->all_animation_controllers(); | 560 animation_registrar_->all_animation_controllers(); |
| 561 AnimationRegistrar::AnimationControllerMap::const_iterator iter = | 561 auto iter = animation_controllers.find(event_layer_id); |
| 562 animation_controllers.find(event_layer_id); | |
| 563 if (iter != animation_controllers.end()) { | 562 if (iter != animation_controllers.end()) { |
| 564 switch ((*events)[event_index].type) { | 563 switch ((*events)[event_index].type) { |
| 565 case AnimationEvent::STARTED: | 564 case AnimationEvent::STARTED: |
| 566 (*iter).second->NotifyAnimationStarted((*events)[event_index]); | 565 (*iter).second->NotifyAnimationStarted((*events)[event_index]); |
| 567 break; | 566 break; |
| 568 | 567 |
| 569 case AnimationEvent::FINISHED: | 568 case AnimationEvent::FINISHED: |
| 570 (*iter).second->NotifyAnimationFinished((*events)[event_index]); | 569 (*iter).second->NotifyAnimationFinished((*events)[event_index]); |
| 571 break; | 570 break; |
| 572 | 571 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 | 660 |
| 662 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { | 661 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { |
| 663 if (device_viewport_size == device_viewport_size_) | 662 if (device_viewport_size == device_viewport_size_) |
| 664 return; | 663 return; |
| 665 | 664 |
| 666 device_viewport_size_ = device_viewport_size; | 665 device_viewport_size_ = device_viewport_size; |
| 667 | 666 |
| 668 SetNeedsCommit(); | 667 SetNeedsCommit(); |
| 669 } | 668 } |
| 670 | 669 |
| 671 void LayerTreeHost::SetTopControlsShrinkBlinkSize(bool shrink) { | 670 void LayerTreeHost::SetTopControlsHeight(float height, bool shrink) { |
| 672 if (top_controls_shrink_blink_size_ == shrink) | 671 if (top_controls_height_ == height && |
| 672 top_controls_shrink_blink_size_ == shrink) |
| 673 return; | 673 return; |
| 674 | 674 |
| 675 top_controls_height_ = height; |
| 675 top_controls_shrink_blink_size_ = shrink; | 676 top_controls_shrink_blink_size_ = shrink; |
| 676 SetNeedsCommit(); | 677 SetNeedsCommit(); |
| 677 } | 678 } |
| 678 | 679 |
| 679 void LayerTreeHost::SetTopControlsHeight(float height) { | |
| 680 if (top_controls_height_ == height) | |
| 681 return; | |
| 682 | |
| 683 top_controls_height_ = height; | |
| 684 SetNeedsCommit(); | |
| 685 } | |
| 686 | |
| 687 void LayerTreeHost::SetTopControlsShownRatio(float ratio) { | 680 void LayerTreeHost::SetTopControlsShownRatio(float ratio) { |
| 688 if (top_controls_shown_ratio_ == ratio) | 681 if (top_controls_shown_ratio_ == ratio) |
| 689 return; | 682 return; |
| 690 | 683 |
| 691 top_controls_shown_ratio_ = ratio; | 684 top_controls_shown_ratio_ = ratio; |
| 692 SetNeedsCommit(); | 685 SetNeedsCommit(); |
| 693 } | 686 } |
| 694 | 687 |
| 695 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { | 688 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { |
| 696 DCHECK(CommitRequested()); | 689 DCHECK(CommitRequested()); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 state->EndDictionary(); | 1186 state->EndDictionary(); |
| 1194 } | 1187 } |
| 1195 | 1188 |
| 1196 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { | 1189 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { |
| 1197 if (!settings_.accelerated_animation_enabled || | 1190 if (!settings_.accelerated_animation_enabled || |
| 1198 animation_registrar_->active_animation_controllers().empty()) | 1191 animation_registrar_->active_animation_controllers().empty()) |
| 1199 return; | 1192 return; |
| 1200 | 1193 |
| 1201 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); | 1194 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); |
| 1202 | 1195 |
| 1203 AnimationRegistrar::AnimationControllerMap copy = | 1196 AnimationRegistrar::AnimationControllerMap active_controllers_copy = |
| 1204 animation_registrar_->active_animation_controllers(); | 1197 animation_registrar_->active_animation_controllers(); |
| 1205 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 1198 for (auto& it : active_controllers_copy) { |
| 1206 iter != copy.end(); | 1199 it.second->Animate(monotonic_time); |
| 1207 ++iter) { | |
| 1208 (*iter).second->Animate(monotonic_time); | |
| 1209 bool start_ready_animations = true; | 1200 bool start_ready_animations = true; |
| 1210 (*iter).second->UpdateState(start_ready_animations, NULL); | 1201 it.second->UpdateState(start_ready_animations, NULL); |
| 1211 } | 1202 } |
| 1212 } | 1203 } |
| 1213 | 1204 |
| 1214 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { | 1205 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { |
| 1215 DCHECK(client); | 1206 DCHECK(client); |
| 1216 | 1207 |
| 1217 UIResourceId next_id = next_ui_resource_id_++; | 1208 UIResourceId next_id = next_ui_resource_id_++; |
| 1218 DCHECK(ui_resource_client_map_.find(next_id) == | 1209 DCHECK(ui_resource_client_map_.find(next_id) == |
| 1219 ui_resource_client_map_.end()); | 1210 ui_resource_client_map_.end()); |
| 1220 | 1211 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 bool children_need_begin_frames) const { | 1327 bool children_need_begin_frames) const { |
| 1337 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); | 1328 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); |
| 1338 } | 1329 } |
| 1339 | 1330 |
| 1340 void LayerTreeHost::SendBeginFramesToChildren( | 1331 void LayerTreeHost::SendBeginFramesToChildren( |
| 1341 const BeginFrameArgs& args) const { | 1332 const BeginFrameArgs& args) const { |
| 1342 client_->SendBeginFramesToChildren(args); | 1333 client_->SendBeginFramesToChildren(args); |
| 1343 } | 1334 } |
| 1344 | 1335 |
| 1345 } // namespace cc | 1336 } // namespace cc |
| OLD | NEW |