| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 { | 211 { |
| 212 DCHECK(m_proxy->isMainThread()); | 212 DCHECK(m_proxy->isMainThread()); |
| 213 m_proxy->acquireLayerTextures(); | 213 m_proxy->acquireLayerTextures(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void LayerTreeHost::didBeginFrame() | 216 void LayerTreeHost::didBeginFrame() |
| 217 { | 217 { |
| 218 m_client->didBeginFrame(); | 218 m_client->didBeginFrame(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void LayerTreeHost::updateAnimations(base::TimeTicks frameBeginTime) | 221 void LayerTreeHost::updateAnimations(base::TimeTicks monotonicFrameBeginTime, ba
se::Time wallClockFrameBeginTime) |
| 222 { | 222 { |
| 223 m_animating = true; | 223 m_animating = true; |
| 224 m_client->animate((frameBeginTime - base::TimeTicks()).InSecondsF()); | 224 m_client->animate((monotonicFrameBeginTime - base::TimeTicks()).InSecondsF()
); |
| 225 animateLayers(frameBeginTime); | 225 animateLayers(monotonicFrameBeginTime, wallClockFrameBeginTime); |
| 226 m_animating = false; | 226 m_animating = false; |
| 227 | 227 |
| 228 m_renderingStats.numAnimationFrames++; | 228 m_renderingStats.numAnimationFrames++; |
| 229 } | 229 } |
| 230 | 230 |
| 231 void LayerTreeHost::didStopFlinging() | 231 void LayerTreeHost::didStopFlinging() |
| 232 { | 232 { |
| 233 m_proxy->mainThreadHasStoppedFlinging(); | 233 m_proxy->mainThreadHasStoppedFlinging(); |
| 234 } | 234 } |
| 235 | 235 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 | 814 |
| 815 void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) | 815 void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) |
| 816 { | 816 { |
| 817 if (deviceScaleFactor == m_deviceScaleFactor) | 817 if (deviceScaleFactor == m_deviceScaleFactor) |
| 818 return; | 818 return; |
| 819 m_deviceScaleFactor = deviceScaleFactor; | 819 m_deviceScaleFactor = deviceScaleFactor; |
| 820 | 820 |
| 821 setNeedsCommit(); | 821 setNeedsCommit(); |
| 822 } | 822 } |
| 823 | 823 |
| 824 void LayerTreeHost::animateLayers(base::TimeTicks time) | 824 void LayerTreeHost::animateLayers(base::TimeTicks monotonicTime, base::Time wall
ClockTime) |
| 825 { | 825 { |
| 826 if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_
animation_controllers().empty()) | 826 if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_
animation_controllers().empty()) |
| 827 return; | 827 return; |
| 828 | 828 |
| 829 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); | 829 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); |
| 830 | 830 |
| 831 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); | 831 double monotonicTimeInSeconds = (monotonicTime - base::TimeTicks()).InSecond
sF(); |
| 832 | 832 |
| 833 AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->acti
ve_animation_controllers(); | 833 AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->acti
ve_animation_controllers(); |
| 834 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(
); iter != copy.end(); ++iter) | 834 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(
); iter != copy.end(); ++iter) |
| 835 (*iter).second->animate(monotonicTime, 0); | 835 (*iter).second->animate(monotonicTimeInSeconds, 0); |
| 836 } | 836 } |
| 837 | 837 |
| 838 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve
nts, Layer* layer, base::Time wallClockTime) | 838 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve
nts, Layer* layer, base::Time wallClockTime) |
| 839 { | 839 { |
| 840 if (!layer) | 840 if (!layer) |
| 841 return; | 841 return; |
| 842 | 842 |
| 843 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { | 843 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { |
| 844 if (layer->id() == events[eventIndex].layerId) { | 844 if (layer->id() == events[eventIndex].layerId) { |
| 845 if (events[eventIndex].type == AnimationEvent::Started) | 845 if (events[eventIndex].type == AnimationEvent::Started) |
| 846 layer->notifyAnimationStarted(events[eventIndex], wallClockTime.
ToDoubleT()); | 846 layer->notifyAnimationStarted(events[eventIndex], wallClockTime.
ToDoubleT()); |
| 847 else | 847 else |
| 848 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 848 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 849 } | 849 } |
| 850 } | 850 } |
| 851 | 851 |
| 852 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 852 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 853 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 853 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 854 } | 854 } |
| 855 | 855 |
| 856 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 856 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
| 857 { | 857 { |
| 858 return m_proxy->capturePicture(); | 858 return m_proxy->capturePicture(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 } // namespace cc | 861 } // namespace cc |
| OLD | NEW |