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

Side by Side Diff: cc/CCLayerTreeHost.cpp

Issue 11028021: cc: Improve frame/commit accounting (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use uint64_t and rename variables to *Count Created 8 years, 2 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
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 "CCLayerTreeHost.h" 7 #include "CCLayerTreeHost.h"
8 8
9 #include "CCFontAtlas.h" 9 #include "CCFontAtlas.h"
10 #include "CCGraphicsContext.h" 10 #include "CCGraphicsContext.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 m_proxy->acquireLayerTextures(); 226 m_proxy->acquireLayerTextures();
227 } 227 }
228 228
229 void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime) 229 void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime)
230 { 230 {
231 m_animating = true; 231 m_animating = true;
232 m_client->animate(monotonicFrameBeginTime); 232 m_client->animate(monotonicFrameBeginTime);
233 animateLayers(monotonicFrameBeginTime); 233 animateLayers(monotonicFrameBeginTime);
234 m_animating = false; 234 m_animating = false;
235 235
236 m_renderingStats.numAnimationFrames++; 236 m_renderingStats.mainAnimationFrameCount++;
237 } 237 }
238 238
239 void CCLayerTreeHost::layout() 239 void CCLayerTreeHost::layout()
240 { 240 {
241 m_client->layout(); 241 m_client->layout();
242 } 242 }
243 243
244 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) 244 void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
245 { 245 {
246 ASSERT(CCProxy::isImplThread()); 246 ASSERT(CCProxy::isImplThread());
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 m_deviceScaleFactor = deviceScaleFactor; 810 m_deviceScaleFactor = deviceScaleFactor;
811 811
812 setNeedsCommit(); 812 setNeedsCommit();
813 } 813 }
814 814
815 void CCLayerTreeHost::animateLayers(double monotonicTime) 815 void CCLayerTreeHost::animateLayers(double monotonicTime)
816 { 816 {
817 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) 817 if (!CCSettings::acceleratedAnimationEnabled() || !m_needsAnimateLayers)
818 return; 818 return;
819 819
820 TRACE_EVENT0("cc", "CCLayerTreeHostImpl::animateLayers"); 820 TRACE_EVENT0("cc", "CCLayerTreeHost::animateLayers");
821 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi me); 821 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), monotonicTi me);
822 } 822 }
823 823
824 bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono tonicTime) 824 bool CCLayerTreeHost::animateLayersRecursive(LayerChromium* current, double mono tonicTime)
825 { 825 {
826 if (!current) 826 if (!current)
827 return false; 827 return false;
828 828
829 bool subtreeNeedsAnimateLayers = false; 829 bool subtreeNeedsAnimateLayers = false;
830 CCLayerAnimationController* currentController = current->layerAnimationContr oller(); 830 CCLayerAnimationController* currentController = current->layerAnimationContr oller();
831 currentController->animate(monotonicTime, 0); 831 currentController->animate(monotonicTime, 0);
832 832
833 // If the current controller still has an active animation, we must continue animating layers. 833 // If the current controller still has an active animation, we must continue animating layers.
834 if (currentController->hasActiveAnimation()) 834 if (currentController->hasActiveAnimation())
835 subtreeNeedsAnimateLayers = true; 835 subtreeNeedsAnimateLayers = true;
836 836
837 for (size_t i = 0; i < current->children().size(); ++i) { 837 for (size_t i = 0; i < current->children().size(); ++i) {
838 if (animateLayersRecursive(current->children()[i].get(), monotonicTime)) 838 if (animateLayersRecursive(current->children()[i].get(), monotonicTime))
839 subtreeNeedsAnimateLayers = true; 839 subtreeNeedsAnimateLayers = true;
840 } 840 }
841
842 return subtreeNeedsAnimateLayers; 841 return subtreeNeedsAnimateLayers;
843 } 842 }
844 843
845 void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector& events, LayerChromium* layer, double wallClockTime) 844 void CCLayerTreeHost::setAnimationEventsRecursive(const CCAnimationEventsVector& events, LayerChromium* layer, double wallClockTime)
846 { 845 {
847 if (!layer) 846 if (!layer)
848 return; 847 return;
849 848
850 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { 849 for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) {
851 if (layer->id() == events[eventIndex].layerId) { 850 if (layer->id() == events[eventIndex].layerId) {
852 if (events[eventIndex].type == CCAnimationEvent::Started) 851 if (events[eventIndex].type == CCAnimationEvent::Started)
853 layer->notifyAnimationStarted(events[eventIndex], wallClockTime) ; 852 layer->notifyAnimationStarted(events[eventIndex], wallClockTime) ;
854 else 853 else
855 layer->notifyAnimationFinished(wallClockTime); 854 layer->notifyAnimationFinished(wallClockTime);
856 } 855 }
857 } 856 }
858 857
859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 858 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 859 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
861 } 860 }
862 861
863 } // namespace cc 862 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698