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

Side by Side Diff: cc/layer_tree_host.cc

Issue 12095053: cc: Avoid expensive RenderingStats collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer.h ('k') | cc/layer_tree_host_impl.cc » ('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 "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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 { 402 {
403 m_proxy->setDeferCommits(deferCommits); 403 m_proxy->setDeferCommits(deferCommits);
404 } 404 }
405 405
406 void LayerTreeHost::didDeferCommit() 406 void LayerTreeHost::didDeferCommit()
407 { 407 {
408 } 408 }
409 409
410 void LayerTreeHost::renderingStats(RenderingStats* stats) const 410 void LayerTreeHost::renderingStats(RenderingStats* stats) const
411 { 411 {
412 CHECK(m_settings.recordRenderingStats);
412 *stats = m_renderingStats; 413 *stats = m_renderingStats;
413 m_proxy->renderingStats(stats); 414 m_proxy->renderingStats(stats);
414 } 415 }
415 416
416 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const 417 const RendererCapabilities& LayerTreeHost::rendererCapabilities() const
417 { 418 {
418 return m_proxy->rendererCapabilities(); 419 return m_proxy->rendererCapabilities();
419 } 420 }
420 421
421 void LayerTreeHost::setNeedsAnimate() 422 void LayerTreeHost::setNeedsAnimate()
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 } 693 }
693 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; 694 return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes;
694 } 695 }
695 696
696 bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, Resour ceUpdateQueue& queue) 697 bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, Resour ceUpdateQueue& queue)
697 { 698 {
698 // Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point 699 // Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point
699 // in code, we already know that at least something will be drawn into this render surface, so the 700 // in code, we already know that at least something will be drawn into this render surface, so the
700 // mask and replica should be painted. 701 // mask and replica should be painted.
701 702
703 RenderingStats* stats = m_settings.recordRenderingStats ? &m_renderingStats : NULL;
704
702 bool needMoreUpdates = false; 705 bool needMoreUpdates = false;
703 Layer* maskLayer = renderSurfaceLayer->maskLayer(); 706 Layer* maskLayer = renderSurfaceLayer->maskLayer();
704 if (maskLayer) { 707 if (maskLayer) {
705 maskLayer->update(queue, 0, m_renderingStats); 708 maskLayer->update(queue, 0, stats);
706 needMoreUpdates |= maskLayer->needMoreUpdates(); 709 needMoreUpdates |= maskLayer->needMoreUpdates();
707 } 710 }
708 711
709 Layer* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurface Layer->replicaLayer()->maskLayer() : 0; 712 Layer* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurface Layer->replicaLayer()->maskLayer() : 0;
710 if (replicaMaskLayer) { 713 if (replicaMaskLayer) {
711 replicaMaskLayer->update(queue, 0, m_renderingStats); 714 replicaMaskLayer->update(queue, 0, stats);
712 needMoreUpdates |= replicaMaskLayer->needMoreUpdates(); 715 needMoreUpdates |= replicaMaskLayer->needMoreUpdates();
713 } 716 }
714 return needMoreUpdates; 717 return needMoreUpdates;
715 } 718 }
716 719
717 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue) 720 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue)
718 { 721 {
719 // Use FrontToBack to allow for testing occlusion and performing culling dur ing the tree walk. 722 // Use FrontToBack to allow for testing occlusion and performing culling dur ing the tree walk.
720 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions: :FrontToBack> LayerIteratorType; 723 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions: :FrontToBack> LayerIteratorType;
721 724
722 bool needMoreUpdates = false; 725 bool needMoreUpdates = false;
723 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); 726 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
724 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect( ), recordMetricsForFrame); 727 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect( ), recordMetricsForFrame);
725 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize); 728 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize);
726 729
727 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics( )); 730 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics( ));
728 731
732 RenderingStats* stats = m_settings.recordRenderingStats ? &m_renderingStats : NULL;
733
729 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); 734 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
730 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) { 735 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) {
731 occlusionTracker.enterLayer(it); 736 occlusionTracker.enterLayer(it);
732 737
733 if (it.representsTargetRenderSurface()) { 738 if (it.representsTargetRenderSurface()) {
734 DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->dr awOpacityIsAnimating()); 739 DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->dr awOpacityIsAnimating());
735 needMoreUpdates |= paintMasksForRenderSurface(*it, queue); 740 needMoreUpdates |= paintMasksForRenderSurface(*it, queue);
736 } else if (it.representsItself()) { 741 } else if (it.representsItself()) {
737 DCHECK(!it->bounds().IsEmpty()); 742 DCHECK(!it->bounds().IsEmpty());
738 it->update(queue, &occlusionTracker, m_renderingStats); 743 it->update(queue, &occlusionTracker, stats);
739 needMoreUpdates |= it->needMoreUpdates(); 744 needMoreUpdates |= it->needMoreUpdates();
740 } 745 }
741 746
742 occlusionTracker.leaveLayer(it); 747 occlusionTracker.leaveLayer(it);
743 } 748 }
744 749
745 occlusionTracker.overdrawMetrics().recordMetrics(this); 750 occlusionTracker.overdrawMetrics().recordMetrics(this);
746 751
747 return needMoreUpdates; 752 return needMoreUpdates;
748 } 753 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 871 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
867 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 872 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
868 } 873 }
869 874
870 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() 875 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture()
871 { 876 {
872 return m_proxy->capturePicture(); 877 return m_proxy->capturePicture();
873 } 878 }
874 879
875 } // namespace cc 880 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer.h ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698