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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11191068: Remove WTF::currentTime() / WTF::monotonicallyIncreasingTime() uses from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_impl.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 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_tree_host.h" 7 #include "cc/layer_tree_host.h"
8 8
9 #include "Region.h" 9 #include "Region.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if (m_rendererInitialized) 216 if (m_rendererInitialized)
217 m_contentsTextureManager->clearAllMemory(resourceProvider); 217 m_contentsTextureManager->clearAllMemory(resourceProvider);
218 } 218 }
219 219
220 void LayerTreeHost::acquireLayerTextures() 220 void LayerTreeHost::acquireLayerTextures()
221 { 221 {
222 DCHECK(Proxy::isMainThread()); 222 DCHECK(Proxy::isMainThread());
223 m_proxy->acquireLayerTextures(); 223 m_proxy->acquireLayerTextures();
224 } 224 }
225 225
226 void LayerTreeHost::updateAnimations(double monotonicFrameBeginTime) 226 void LayerTreeHost::updateAnimations(base::TimeTicks frameBeginTime)
227 { 227 {
228 m_animating = true; 228 m_animating = true;
229 m_client->animate(monotonicFrameBeginTime); 229 m_client->animate((frameBeginTime - base::TimeTicks()).InSecondsF());
230 animateLayers(monotonicFrameBeginTime); 230 animateLayers(frameBeginTime);
231 m_animating = false; 231 m_animating = false;
232 232
233 m_renderingStats.numAnimationFrames++; 233 m_renderingStats.numAnimationFrames++;
234 } 234 }
235 235
236 void LayerTreeHost::layout() 236 void LayerTreeHost::layout()
237 { 237 {
238 m_client->layout(); 238 m_client->layout();
239 } 239 }
240 240
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 m_proxy->setNeedsRedraw(); 385 m_proxy->setNeedsRedraw();
386 if (!ThreadProxy::implThread()) 386 if (!ThreadProxy::implThread())
387 m_client->scheduleComposite(); 387 m_client->scheduleComposite();
388 } 388 }
389 389
390 bool LayerTreeHost::commitRequested() const 390 bool LayerTreeHost::commitRequested() const
391 { 391 {
392 return m_proxy->commitRequested(); 392 return m_proxy->commitRequested();
393 } 393 }
394 394
395 void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, double wallClockTime) 395 void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime)
396 { 396 {
397 DCHECK(ThreadProxy::isMainThread()); 397 DCHECK(ThreadProxy::isMainThread());
398 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime) ; 398 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime) ;
399 } 399 }
400 400
401 void LayerTreeHost::didAddAnimation() 401 void LayerTreeHost::didAddAnimation()
402 { 402 {
403 m_needsAnimateLayers = true; 403 m_needsAnimateLayers = true;
404 m_proxy->didAddAnimation(); 404 m_proxy->didAddAnimation();
405 } 405 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 } 444 }
445 445
446 void LayerTreeHost::setVisible(bool visible) 446 void LayerTreeHost::setVisible(bool visible)
447 { 447 {
448 if (m_visible == visible) 448 if (m_visible == visible)
449 return; 449 return;
450 m_visible = visible; 450 m_visible = visible;
451 m_proxy->setVisible(visible); 451 m_proxy->setVisible(visible);
452 } 452 }
453 453
454 void LayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) 454 void LayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration)
455 { 455 {
456 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationS ec); 456 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, duration) ;
457 } 457 }
458 458
459 void LayerTreeHost::loseContext(int numTimes) 459 void LayerTreeHost::loseContext(int numTimes)
460 { 460 {
461 TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTi mes); 461 TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorContext", "numTimes", numTi mes);
462 m_numTimesRecreateShouldFail = numTimes - 1; 462 m_numTimesRecreateShouldFail = numTimes - 1;
463 m_proxy->loseContext(); 463 m_proxy->loseContext();
464 } 464 }
465 465
466 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const 466 PrioritizedTextureManager* LayerTreeHost::contentsTextureManager() const
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 762
763 void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) 763 void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor)
764 { 764 {
765 if (deviceScaleFactor == m_deviceScaleFactor) 765 if (deviceScaleFactor == m_deviceScaleFactor)
766 return; 766 return;
767 m_deviceScaleFactor = deviceScaleFactor; 767 m_deviceScaleFactor = deviceScaleFactor;
768 768
769 setNeedsCommit(); 769 setNeedsCommit();
770 } 770 }
771 771
772 void LayerTreeHost::animateLayers(double monotonicTime) 772 void LayerTreeHost::animateLayers(base::TimeTicks time)
773 { 773 {
774 if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) 774 if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers)
775 return; 775 return;
776 776
777 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); 777 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers");
778 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi me); 778 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), time);
779 } 779 }
780 780
781 bool LayerTreeHost::animateLayersRecursive(Layer* current, double monotonicTime) 781 bool LayerTreeHost::animateLayersRecursive(Layer* current, base::TimeTicks time)
782 { 782 {
783 if (!current) 783 if (!current)
784 return false; 784 return false;
785 785
786 bool subtreeNeedsAnimateLayers = false; 786 bool subtreeNeedsAnimateLayers = false;
787 LayerAnimationController* currentController = current->layerAnimationControl ler(); 787 LayerAnimationController* currentController = current->layerAnimationControl ler();
788 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
788 currentController->animate(monotonicTime, 0); 789 currentController->animate(monotonicTime, 0);
789 790
790 // If the current controller still has an active animation, we must continue animating layers. 791 // If the current controller still has an active animation, we must continue animating layers.
791 if (currentController->hasActiveAnimation()) 792 if (currentController->hasActiveAnimation())
792 subtreeNeedsAnimateLayers = true; 793 subtreeNeedsAnimateLayers = true;
793 794
794 for (size_t i = 0; i < current->children().size(); ++i) { 795 for (size_t i = 0; i < current->children().size(); ++i) {
795 if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) 796 if (animateLayersRecursive(current->children()[i].get(), time))
796 subtreeNeedsAnimateLayers = true; 797 subtreeNeedsAnimateLayers = true;
797 } 798 }
798 799
799 return subtreeNeedsAnimateLayers; 800 return subtreeNeedsAnimateLayers;
800 } 801 }
801 802
802 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve nts, Layer* layer, double wallClockTime) 803 void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& eve nts, Layer* layer, base::Time wallClockTime)
803 { 804 {
804 if (!layer) 805 if (!layer)
805 return; 806 return;
806 807
807 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { 808 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) {
808 if (layer->id() == events[eventIndex].layerId) { 809 if (layer->id() == events[eventIndex].layerId) {
809 if (events[eventIndex].type == AnimationEvent::Started) 810 if (events[eventIndex].type == AnimationEvent::Started)
810 layer->notifyAnimationStarted(events[eventIndex], wallClockTime) ; 811 layer->notifyAnimationStarted(events[eventIndex], wallClockTime. ToDoubleT());
811 else 812 else
812 layer->notifyAnimationFinished(wallClockTime); 813 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
813 } 814 }
814 } 815 }
815 816
816 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 817 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
817 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 818 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
818 } 819 }
819 820
820 } // namespace cc 821 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698