| 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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 layer->setNeedsDisplay(); | 229 layer->setNeedsDisplay(); |
| 230 | 230 |
| 231 setNeedsDisplayOnAllLayersRecursive(layer->maskLayer()); | 231 setNeedsDisplayOnAllLayersRecursive(layer->maskLayer()); |
| 232 setNeedsDisplayOnAllLayersRecursive(layer->replicaLayer()); | 232 setNeedsDisplayOnAllLayersRecursive(layer->replicaLayer()); |
| 233 | 233 |
| 234 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 234 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 235 setNeedsDisplayOnAllLayersRecursive(layer->children()[childIndex].get())
; | 235 setNeedsDisplayOnAllLayersRecursive(layer->children()[childIndex].get())
; |
| 236 } | 236 } |
| 237 | 237 |
| 238 void LayerTreeHost::updateAnimations(base::TimeTicks frameBeginTime) | 238 void LayerTreeHost::updateAnimations(base::TimeTicks monotonicFrameBeginTime, ba
se::Time wallClockFrameBeginTime) |
| 239 { | 239 { |
| 240 m_animating = true; | 240 m_animating = true; |
| 241 m_client->animate((frameBeginTime - base::TimeTicks()).InSecondsF()); | 241 m_client->animate((monotonicFrameBeginTime - base::TimeTicks()).InSecondsF()
); |
| 242 animateLayers(frameBeginTime); | 242 animateLayers(monotonicFrameBeginTime, wallClockFrameBeginTime); |
| 243 m_animating = false; | 243 m_animating = false; |
| 244 | 244 |
| 245 m_renderingStats.numAnimationFrames++; | 245 m_renderingStats.numAnimationFrames++; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void LayerTreeHost::didStopFlinging() | 248 void LayerTreeHost::didStopFlinging() |
| 249 { | 249 { |
| 250 m_proxy->mainThreadHasStoppedFlinging(); | 250 m_proxy->mainThreadHasStoppedFlinging(); |
| 251 } | 251 } |
| 252 | 252 |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 | 851 |
| 852 void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) | 852 void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) |
| 853 { | 853 { |
| 854 if (deviceScaleFactor == m_deviceScaleFactor) | 854 if (deviceScaleFactor == m_deviceScaleFactor) |
| 855 return; | 855 return; |
| 856 m_deviceScaleFactor = deviceScaleFactor; | 856 m_deviceScaleFactor = deviceScaleFactor; |
| 857 | 857 |
| 858 setNeedsCommit(); | 858 setNeedsCommit(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 void LayerTreeHost::animateLayers(base::TimeTicks time) | 861 void LayerTreeHost::animateLayers(base::TimeTicks monotonicTime, base::Time wall
ClockTime) |
| 862 { | 862 { |
| 863 if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_
animation_controllers().empty()) | 863 if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_
animation_controllers().empty()) |
| 864 return; | 864 return; |
| 865 | 865 |
| 866 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); | 866 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); |
| 867 | 867 |
| 868 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 868 double monotonicTimeInSeconds = (monotonicTime - base::TimeTicks()).InSecond
sF(); |
| 869 | 869 |
| 870 AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->acti
ve_animation_controllers(); | 870 AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->acti
ve_animation_controllers(); |
| 871 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(
); iter != copy.end(); ++iter) | 871 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(
); iter != copy.end(); ++iter) |
| 872 (*iter).second->animate(monotonicTime, 0); | 872 (*iter).second->animate(monotonicTimeInSeconds, 0); |
| 873 } | 873 } |
| 874 | 874 |
| 875 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve
nts, Layer* layer, base::Time wallClockTime) | 875 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve
nts, Layer* layer, base::Time wallClockTime) |
| 876 { | 876 { |
| 877 if (!layer) | 877 if (!layer) |
| 878 return; | 878 return; |
| 879 | 879 |
| 880 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { | 880 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { |
| 881 if (layer->id() == events[eventIndex].layerId) { | 881 if (layer->id() == events[eventIndex].layerId) { |
| 882 if (events[eventIndex].type == AnimationEvent::Started) | 882 if (events[eventIndex].type == AnimationEvent::Started) |
| 883 layer->notifyAnimationStarted(events[eventIndex], wallClockTime.
ToDoubleT()); | 883 layer->notifyAnimationStarted(events[eventIndex], wallClockTime.
ToDoubleT()); |
| 884 else | 884 else |
| 885 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 885 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 886 } | 886 } |
| 887 } | 887 } |
| 888 | 888 |
| 889 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 889 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 890 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 890 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 891 } | 891 } |
| 892 | 892 |
| 893 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 893 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
| 894 { | 894 { |
| 895 return m_proxy->capturePicture(); | 895 return m_proxy->capturePicture(); |
| 896 } | 896 } |
| 897 | 897 |
| 898 } // namespace cc | 898 } // namespace cc |
| OLD | NEW |