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

Side by Side Diff: cc/layer_animation_controller.cc

Issue 11830056: Enable accelerated animations for orphaned layers (Closed) Base URL: http://git.chromium.org/chromium/src.git@MakeLayerTreeHostAnimateLayersTakeWallClockTime
Patch Set: Fix nit Created 7 years, 11 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/layer_animation_controller.h ('k') | cc/layer_animation_value_observer.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/layer_animation_controller.h" 5 #include "cc/layer_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/animation.h" 9 #include "cc/animation.h"
10 #include "cc/animation_registrar.h" 10 #include "cc/animation_registrar.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 { 224 {
225 if (!m_observers.HasObserver(observer)) 225 if (!m_observers.HasObserver(observer))
226 m_observers.AddObserver(observer); 226 m_observers.AddObserver(observer);
227 } 227 }
228 228
229 void LayerAnimationController::removeObserver(LayerAnimationValueObserver* obser ver) 229 void LayerAnimationController::removeObserver(LayerAnimationValueObserver* obser ver)
230 { 230 {
231 m_observers.RemoveObserver(observer); 231 m_observers.RemoveObserver(observer);
232 } 232 }
233 233
234 bool LayerAnimationController::hasNonOrphanedObserver()
235 {
236 if (m_observers.might_have_observers()) {
237 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers);
238 LayerAnimationValueObserver* obs;
239 while ((obs = it.GetNext()) != NULL) {
240 if (!obs->IsOrphaned())
241 return true;
242 }
243 }
244 return false;
245 }
246
234 void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr oller* controllerImpl) const 247 void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr oller* controllerImpl) const
235 { 248 {
236 // Any new animations owned by the main thread's controller are cloned and a dde to the impl thread's controller. 249 // Any new animations owned by the main thread's controller are cloned and a dde to the impl thread's controller.
237 for (size_t i = 0; i < m_activeAnimations.size(); ++i) { 250 for (size_t i = 0; i < m_activeAnimations.size(); ++i) {
238 // If the animation is already running on the impl thread, there is no n eed to copy it over. 251 // If the animation is already running on the impl thread, there is no n eed to copy it over.
239 if (controllerImpl->getAnimation(m_activeAnimations[i]->group(), m_activ eAnimations[i]->targetProperty())) 252 if (controllerImpl->getAnimation(m_activeAnimations[i]->group(), m_activ eAnimations[i]->targetProperty()))
240 continue; 253 continue;
241 254
242 // If the animation is not running on the impl thread, it does not neces sarily mean that it needs 255 // If the animation is not running on the impl thread, it does not neces sarily mean that it needs
243 // to be copied over and started; it may have already finished. In this case, the impl thread animation 256 // to be copied over and started; it may have already finished. In this case, the impl thread animation
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers); 513 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers);
501 LayerAnimationValueObserver* obs; 514 LayerAnimationValueObserver* obs;
502 while ((obs = it.GetNext()) != NULL) 515 while ((obs = it.GetNext()) != NULL)
503 if (obs->IsActive()) 516 if (obs->IsActive())
504 return true; 517 return true;
505 } 518 }
506 return false; 519 return false;
507 } 520 }
508 521
509 } // namespace cc 522 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_animation_controller.h ('k') | cc/layer_animation_value_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698