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

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_common.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 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 proxy_->SetNextCommitWaitsForActivation(); 537 proxy_->SetNextCommitWaitsForActivation();
538 } 538 }
539 539
540 void LayerTreeHost::SetNextCommitForcesRedraw() { 540 void LayerTreeHost::SetNextCommitForcesRedraw() {
541 next_commit_forces_redraw_ = true; 541 next_commit_forces_redraw_ = true;
542 } 542 }
543 543
544 void LayerTreeHost::SetAnimationEvents( 544 void LayerTreeHost::SetAnimationEvents(
545 scoped_ptr<AnimationEventsVector> events) { 545 scoped_ptr<AnimationEventsVector> events) {
546 DCHECK(proxy_->IsMainThread()); 546 DCHECK(proxy_->IsMainThread());
547 for (size_t event_index = 0; event_index < events->size(); ++event_index) { 547 animation_registrar_->SetAnimationEvents(events.Pass());
548 int event_layer_id = (*events)[event_index].layer_id;
549
550 // Use the map of all controllers, not just active ones, since non-active
551 // controllers may still receive events for impl-only animations.
552 const AnimationRegistrar::AnimationControllerMap& animation_controllers =
553 animation_registrar_->all_animation_controllers();
554 auto iter = animation_controllers.find(event_layer_id);
555 if (iter != animation_controllers.end()) {
556 switch ((*events)[event_index].type) {
557 case AnimationEvent::STARTED:
558 (*iter).second->NotifyAnimationStarted((*events)[event_index]);
559 break;
560
561 case AnimationEvent::FINISHED:
562 (*iter).second->NotifyAnimationFinished((*events)[event_index]);
563 break;
564
565 case AnimationEvent::ABORTED:
566 (*iter).second->NotifyAnimationAborted((*events)[event_index]);
567 break;
568
569 case AnimationEvent::PROPERTY_UPDATE:
570 (*iter).second->NotifyAnimationPropertyUpdate((*events)[event_index]);
571 break;
572 }
573 }
574 }
575 } 548 }
576 549
577 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { 550 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
578 if (root_layer_.get() == root_layer.get()) 551 if (root_layer_.get() == root_layer.get())
579 return; 552 return;
580 553
581 if (root_layer_.get()) 554 if (root_layer_.get())
582 root_layer_->SetLayerTreeHost(NULL); 555 root_layer_->SetLayerTreeHost(NULL);
583 root_layer_ = root_layer; 556 root_layer_ = root_layer;
584 if (root_layer_.get()) { 557 if (root_layer_.get()) {
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 // Top controls are only used in threaded mode. 1131 // Top controls are only used in threaded mode.
1159 proxy_->ImplThreadTaskRunner()->PostTask( 1132 proxy_->ImplThreadTaskRunner()->PostTask(
1160 FROM_HERE, 1133 FROM_HERE,
1161 base::Bind(&TopControlsManager::UpdateTopControlsState, 1134 base::Bind(&TopControlsManager::UpdateTopControlsState,
1162 top_controls_manager_weak_ptr_, 1135 top_controls_manager_weak_ptr_,
1163 constraints, 1136 constraints,
1164 current, 1137 current,
1165 animate)); 1138 animate));
1166 } 1139 }
1167 1140
1168 void LayerTreeHost::AsValueInto(base::trace_event::TracedValue* state) const {
1169 state->BeginDictionary("proxy");
1170 proxy_->AsValueInto(state);
1171 state->EndDictionary();
1172 }
1173
1174 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { 1141 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
1175 if (!settings_.accelerated_animation_enabled || 1142 if (!settings_.accelerated_animation_enabled)
1176 animation_registrar_->active_animation_controllers().empty())
1177 return; 1143 return;
1178 1144
1179 TRACE_EVENT0("cc", "LayerTreeHost::AnimateLayers"); 1145 if (animation_registrar_->AnimateLayers(monotonic_time))
1180 1146 animation_registrar_->UpdateAnimationState(true, NULL);
1181 AnimationRegistrar::AnimationControllerMap active_controllers_copy =
1182 animation_registrar_->active_animation_controllers();
1183 for (auto& it : active_controllers_copy) {
1184 it.second->Animate(monotonic_time);
1185 bool start_ready_animations = true;
1186 it.second->UpdateState(start_ready_animations, NULL);
1187 }
1188 } 1147 }
1189 1148
1190 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { 1149 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) {
1191 DCHECK(client); 1150 DCHECK(client);
1192 1151
1193 UIResourceId next_id = next_ui_resource_id_++; 1152 UIResourceId next_id = next_ui_resource_id_++;
1194 DCHECK(ui_resource_client_map_.find(next_id) == 1153 DCHECK(ui_resource_client_map_.find(next_id) ==
1195 ui_resource_client_map_.end()); 1154 ui_resource_client_map_.end());
1196 1155
1197 bool resource_lost = false; 1156 bool resource_lost = false;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 bool children_need_begin_frames) const { 1271 bool children_need_begin_frames) const {
1313 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); 1272 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames);
1314 } 1273 }
1315 1274
1316 void LayerTreeHost::SendBeginFramesToChildren( 1275 void LayerTreeHost::SendBeginFramesToChildren(
1317 const BeginFrameArgs& args) const { 1276 const BeginFrameArgs& args) const {
1318 client_->SendBeginFramesToChildren(args); 1277 client_->SendBeginFramesToChildren(args);
1319 } 1278 }
1320 1279
1321 } // namespace cc 1280 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698