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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11361223: cc: Remove cc::settings, move them to LayerTreeSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 "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 "cc/font_atlas.h" 10 #include "cc/font_atlas.h"
11 #include "cc/graphics_context.h" 11 #include "cc/graphics_context.h"
12 #include "cc/heads_up_display_layer.h" 12 #include "cc/heads_up_display_layer.h"
13 #include "cc/heads_up_display_layer_impl.h" 13 #include "cc/heads_up_display_layer_impl.h"
14 #include "cc/layer.h" 14 #include "cc/layer.h"
15 #include "cc/layer_animation_controller.h" 15 #include "cc/layer_animation_controller.h"
16 #include "cc/layer_iterator.h" 16 #include "cc/layer_iterator.h"
17 #include "cc/layer_tree_host_client.h" 17 #include "cc/layer_tree_host_client.h"
18 #include "cc/layer_tree_host_common.h" 18 #include "cc/layer_tree_host_common.h"
19 #include "cc/layer_tree_host_impl.h" 19 #include "cc/layer_tree_host_impl.h"
20 #include "cc/math_util.h" 20 #include "cc/math_util.h"
21 #include "cc/occlusion_tracker.h" 21 #include "cc/occlusion_tracker.h"
22 #include "cc/overdraw_metrics.h" 22 #include "cc/overdraw_metrics.h"
23 #include "cc/settings.h"
24 #include "cc/single_thread_proxy.h" 23 #include "cc/single_thread_proxy.h"
25 #include "cc/switches.h" 24 #include "cc/switches.h"
26 #include "cc/thread.h" 25 #include "cc/thread.h"
27 #include "cc/thread_proxy.h" 26 #include "cc/thread_proxy.h"
28 #include "cc/tree_synchronizer.h" 27 #include "cc/tree_synchronizer.h"
29 28
30 using namespace std; 29 using namespace std;
31 30
32 namespace { 31 namespace {
33 static int numLayerTreeInstances; 32 static int numLayerTreeInstances;
34 } 33 }
35 34
36 namespace cc { 35 namespace cc {
37 36
38 bool LayerTreeHost::s_needsFilterContext = false; 37 bool LayerTreeHost::s_needsFilterContext = false;
39 38
40 LayerTreeSettings::LayerTreeSettings() 39 LayerTreeSettings::LayerTreeSettings()
41 : acceleratePainting(false) 40 : acceleratePainting(false)
42 , showPlatformLayerTree(false) 41 , showPlatformLayerTree(false)
43 , showPaintRects(false) 42 , showPaintRects(false)
44 , showPropertyChangedRects(false) 43 , showPropertyChangedRects(false)
45 , showSurfaceDamageRects(false) 44 , showSurfaceDamageRects(false)
46 , showScreenSpaceRects(false) 45 , showScreenSpaceRects(false)
47 , showReplicaScreenSpaceRects(false) 46 , showReplicaScreenSpaceRects(false)
48 , showOccludingRects(false) 47 , showOccludingRects(false)
49 , renderVSyncEnabled(true) 48 , renderVSyncEnabled(true)
49 , perTilePaintingEnabled(false)
50 , partialSwapEnabled(false)
51 , acceleratedAnimationEnabled(false)
52 , pageScalePinchZoomEnabled(false)
53 , jankInsteadOfCheckerboard(false)
slavi 2012/11/14 00:54:58 Wasn't jank-instead-of-checkerboard removed a coup
danakj 2012/11/14 00:56:36 it's in the process of dying in the CQ.
54 , backgroundColorInsteadOfCheckerboard(false)
55 , showOverdrawInTracing(false)
50 , refreshRate(0) 56 , refreshRate(0)
51 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) 57 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
52 , defaultTileSize(gfx::Size(256, 256)) 58 , defaultTileSize(gfx::Size(256, 256))
53 , maxUntiledLayerSize(gfx::Size(512, 512)) 59 , maxUntiledLayerSize(gfx::Size(512, 512))
54 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) 60 , minimumOcclusionTrackingSize(gfx::Size(160, 160))
55 { 61 {
56 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore. 62 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore.
57 showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::s witches::kShowPropertyChangedRects); 63 showPropertyChangedRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::s witches::kShowPropertyChangedRects);
58 showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kShowSurfaceDamageRects); 64 showSurfaceDamageRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kShowSurfaceDamageRects);
59 showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc hes::kShowScreenSpaceRects); 65 showScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switc hes::kShowScreenSpaceRects);
60 showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc ::switches::kShowReplicaScreenSpaceRects); 66 showReplicaScreenSpaceRects = CommandLine::ForCurrentProcess()->HasSwitch(cc ::switches::kShowReplicaScreenSpaceRects);
61 showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switche s::kShowOccludingRects); 67 showOccludingRects = CommandLine::ForCurrentProcess()->HasSwitch(cc::switche s::kShowOccludingRects);
68 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap);
69 jankInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(swit ches::kJankInsteadOfCheckerboard);
70 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard);
71 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw);
62 } 72 }
63 73
64 LayerTreeSettings::~LayerTreeSettings() 74 LayerTreeSettings::~LayerTreeSettings()
65 { 75 {
66 } 76 }
67 77
68 RendererCapabilities::RendererCapabilities() 78 RendererCapabilities::RendererCapabilities()
69 : bestTextureFormat(0) 79 : bestTextureFormat(0)
70 , contextHasCachedFrontBuffer(false) 80 , contextHasCachedFrontBuffer(false)
71 , usingPartialSwap(false) 81 , usingPartialSwap(false)
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return 0; 548 return 0;
539 } 549 }
540 550
541 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue) 551 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue)
542 { 552 {
543 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); 553 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers");
544 554
545 LayerList updateList; 555 LayerList updateList;
546 556
547 { 557 {
548 if (Settings::pageScalePinchZoomEnabled()) { 558 if (m_settings.pageScalePinchZoomEnabled) {
549 Layer* rootScroll = findFirstScrollableLayer(rootLayer); 559 Layer* rootScroll = findFirstScrollableLayer(rootLayer);
550 if (rootScroll) 560 if (rootScroll)
551 rootScroll->setImplTransform(m_implTransform); 561 rootScroll->setImplTransform(m_implTransform);
552 } 562 }
553 563
554 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); 564 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc");
555 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSi ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS ize, updateList); 565 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSi ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS ize, updateList);
556 } 566 }
557 567
558 // Reset partial texture update requests. 568 // Reset partial texture update requests.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 675 }
666 return needMoreUpdates; 676 return needMoreUpdates;
667 } 677 }
668 678
669 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue) 679 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue)
670 { 680 {
671 // Use FrontToBack to allow for testing occlusion and performing culling dur ing the tree walk. 681 // Use FrontToBack to allow for testing occlusion and performing culling dur ing the tree walk.
672 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions: :FrontToBack> LayerIteratorType; 682 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions: :FrontToBack> LayerIteratorType;
673 683
674 bool needMoreUpdates = false; 684 bool needMoreUpdates = false;
675 bool recordMetricsForFrame = Settings::traceOverdraw() && base::debug::Trace Log::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); 685 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
676 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect( ), recordMetricsForFrame); 686 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect( ), recordMetricsForFrame);
677 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize); 687 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize);
678 688
679 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics( )); 689 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics( ));
680 690
681 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); 691 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
682 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) { 692 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) {
683 occlusionTracker.enterLayer(it); 693 occlusionTracker.enterLayer(it);
684 694
685 if (it.representsTargetRenderSurface()) { 695 if (it.representsTargetRenderSurface()) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 { 806 {
797 if (deviceScaleFactor == m_deviceScaleFactor) 807 if (deviceScaleFactor == m_deviceScaleFactor)
798 return; 808 return;
799 m_deviceScaleFactor = deviceScaleFactor; 809 m_deviceScaleFactor = deviceScaleFactor;
800 810
801 setNeedsCommit(); 811 setNeedsCommit();
802 } 812 }
803 813
804 void LayerTreeHost::animateLayers(base::TimeTicks time) 814 void LayerTreeHost::animateLayers(base::TimeTicks time)
805 { 815 {
806 if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) 816 if (!m_settings.acceleratedAnimationEnabled || !m_needsAnimateLayers)
807 return; 817 return;
808 818
809 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); 819 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers");
810 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), time); 820 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), time);
811 } 821 }
812 822
813 bool LayerTreeHost::animateLayersRecursive(Layer* current, base::TimeTicks time) 823 bool LayerTreeHost::animateLayersRecursive(Layer* current, base::TimeTicks time)
814 { 824 {
815 if (!current) 825 if (!current)
816 return false; 826 return false;
(...skipping 27 matching lines...) Expand all
844 else 854 else
845 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 855 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
846 } 856 }
847 } 857 }
848 858
849 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
850 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
851 } 861 }
852 862
853 } // namespace cc 863 } // 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