Chromium Code Reviews| 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/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 Loading... | |
| 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) | |
|
jamesr
2013/01/14 21:57:27
use braces since the block is more than 1 line
ajuma
2013/01/15 16:18:42
Done.
| |
| 240 if (!obs->IsOrphaned()) | |
| 241 return true; | |
| 242 } | |
| 243 return false; | |
| 244 } | |
| 245 | |
| 234 void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr oller* controllerImpl) const | 246 void LayerAnimationController::pushNewAnimationsToImplThread(LayerAnimationContr oller* controllerImpl) const |
| 235 { | 247 { |
| 236 // Any new animations owned by the main thread's controller are cloned and a dde to the impl thread's controller. | 248 // 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) { | 249 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. | 250 // 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())) | 251 if (controllerImpl->getAnimation(m_activeAnimations[i]->group(), m_activ eAnimations[i]->targetProperty())) |
| 240 continue; | 252 continue; |
| 241 | 253 |
| 242 // If the animation is not running on the impl thread, it does not neces sarily mean that it needs | 254 // 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 | 255 // 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 Loading... | |
| 500 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers); | 512 ObserverListBase<LayerAnimationValueObserver>::Iterator it(m_observers); |
| 501 LayerAnimationValueObserver* obs; | 513 LayerAnimationValueObserver* obs; |
| 502 while ((obs = it.GetNext()) != NULL) | 514 while ((obs = it.GetNext()) != NULL) |
| 503 if (obs->IsActive()) | 515 if (obs->IsActive()) |
| 504 return true; | 516 return true; |
| 505 } | 517 } |
| 506 return false; | 518 return false; |
| 507 } | 519 } |
| 508 | 520 |
| 509 } // namespace cc | 521 } // namespace cc |
| OLD | NEW |