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

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: Using WebLayerTreeSettings for things WebKit can 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/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
8 #include "base/message_loop.h" 9 #include "base/message_loop.h"
9 #include "cc/font_atlas.h" 10 #include "cc/font_atlas.h"
10 #include "cc/graphics_context.h" 11 #include "cc/graphics_context.h"
11 #include "cc/heads_up_display_layer.h" 12 #include "cc/heads_up_display_layer.h"
12 #include "cc/heads_up_display_layer_impl.h" 13 #include "cc/heads_up_display_layer_impl.h"
13 #include "cc/layer.h" 14 #include "cc/layer.h"
14 #include "cc/layer_animation_controller.h" 15 #include "cc/layer_animation_controller.h"
15 #include "cc/layer_iterator.h" 16 #include "cc/layer_iterator.h"
16 #include "cc/layer_tree_host_client.h" 17 #include "cc/layer_tree_host_client.h"
17 #include "cc/layer_tree_host_common.h" 18 #include "cc/layer_tree_host_common.h"
18 #include "cc/layer_tree_host_impl.h" 19 #include "cc/layer_tree_host_impl.h"
19 #include "cc/math_util.h" 20 #include "cc/math_util.h"
20 #include "cc/occlusion_tracker.h" 21 #include "cc/occlusion_tracker.h"
21 #include "cc/overdraw_metrics.h" 22 #include "cc/overdraw_metrics.h"
22 #include "cc/settings.h"
23 #include "cc/single_thread_proxy.h" 23 #include "cc/single_thread_proxy.h"
24 #include "cc/switches.h"
24 #include "cc/thread.h" 25 #include "cc/thread.h"
25 #include "cc/thread_proxy.h" 26 #include "cc/thread_proxy.h"
26 #include "cc/tree_synchronizer.h" 27 #include "cc/tree_synchronizer.h"
27 28
28 using namespace std; 29 using namespace std;
29 30
30 namespace { 31 namespace {
31 static int numLayerTreeInstances; 32 static int numLayerTreeInstances;
32 } 33 }
33 34
34 namespace cc { 35 namespace cc {
35 36
36 bool LayerTreeHost::s_needsFilterContext = false; 37 bool LayerTreeHost::s_needsFilterContext = false;
37 38
38 LayerTreeSettings::LayerTreeSettings() 39 LayerTreeSettings::LayerTreeSettings()
39 : acceleratePainting(false) 40 : acceleratePainting(false)
40 , showPlatformLayerTree(false) 41 , showPlatformLayerTree(false)
41 , showPaintRects(false) 42 , showPaintRects(false)
42 , showPropertyChangedRects(false) 43 , showPropertyChangedRects(false)
43 , showSurfaceDamageRects(false) 44 , showSurfaceDamageRects(false)
44 , showScreenSpaceRects(false) 45 , showScreenSpaceRects(false)
45 , showReplicaScreenSpaceRects(false) 46 , showReplicaScreenSpaceRects(false)
46 , showOccludingRects(false) 47 , showOccludingRects(false)
47 , renderVSyncEnabled(true) 48 , renderVSyncEnabled(true)
49 , perTilePaintingEnabled(false)
50 , partialSwapEnabled(false)
51 , acceleratedAnimationEnabled(false)
52 , pageScalePinchZoomEnabled(false)
53 , jankInsteadOfCheckerboard(false)
54 , backgroundColorInsteadOfCheckerboard(false)
55 , showOverdrawInTracing(false)
48 , refreshRate(0) 56 , refreshRate(0)
49 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) 57 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
50 , defaultTileSize(gfx::Size(256, 256)) 58 , defaultTileSize(gfx::Size(256, 256))
51 , maxUntiledLayerSize(gfx::Size(512, 512)) 59 , maxUntiledLayerSize(gfx::Size(512, 512))
52 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) 60 , minimumOcclusionTrackingSize(gfx::Size(160, 160))
53 { 61 {
62 // TODO(danakj): Move these to chromium after we stop going through the WebK it API.
danakj 2012/11/13 02:33:08 Should I move these over to web_layer_tree_view_im
danakj 2012/11/13 02:35:12 Oh, nevermind. I see that the UI also creates its
63 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap);
64 jankInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->HasSwitch(swit ches::kJankInsteadOfCheckerboard);
65 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard);
66 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw);
54 } 67 }
55 68
56 LayerTreeSettings::~LayerTreeSettings() 69 LayerTreeSettings::~LayerTreeSettings()
57 { 70 {
58 } 71 }
59 72
60 RendererCapabilities::RendererCapabilities() 73 RendererCapabilities::RendererCapabilities()
61 : bestTextureFormat(0) 74 : bestTextureFormat(0)
62 , contextHasCachedFrontBuffer(false) 75 , contextHasCachedFrontBuffer(false)
63 , usingPartialSwap(false) 76 , usingPartialSwap(false)
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 return 0; 545 return 0;
533 } 546 }
534 547
535 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue) 548 void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue)
536 { 549 {
537 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); 550 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers");
538 551
539 LayerList updateList; 552 LayerList updateList;
540 553
541 { 554 {
542 if (Settings::pageScalePinchZoomEnabled()) { 555 if (m_settings.pageScalePinchZoomEnabled) {
543 Layer* rootScroll = findFirstScrollableLayer(rootLayer); 556 Layer* rootScroll = findFirstScrollableLayer(rootLayer);
544 if (rootScroll) 557 if (rootScroll)
545 rootScroll->setImplTransform(m_implTransform); 558 rootScroll->setImplTransform(m_implTransform);
546 } 559 }
547 560
548 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); 561 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc");
549 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSi ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS ize, updateList); 562 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSi ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS ize, updateList);
550 } 563 }
551 564
552 // Reset partial texture update requests. 565 // Reset partial texture update requests.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 672 }
660 return needMoreUpdates; 673 return needMoreUpdates;
661 } 674 }
662 675
663 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue) 676 bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue)
664 { 677 {
665 // Use FrontToBack to allow for testing occlusion and performing culling dur ing the tree walk. 678 // Use FrontToBack to allow for testing occlusion and performing culling dur ing the tree walk.
666 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions: :FrontToBack> LayerIteratorType; 679 typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions: :FrontToBack> LayerIteratorType;
667 680
668 bool needMoreUpdates = false; 681 bool needMoreUpdates = false;
669 bool recordMetricsForFrame = Settings::traceOverdraw() && base::debug::Trace Log::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); 682 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
670 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect( ), recordMetricsForFrame); 683 OcclusionTracker occlusionTracker(m_rootLayer->renderSurface()->contentRect( ), recordMetricsForFrame);
671 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize); 684 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize);
672 685
673 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics( )); 686 prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics( ));
674 687
675 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); 688 LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList);
676 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) { 689 for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList ); it != end; ++it) {
677 occlusionTracker.enterLayer(it); 690 occlusionTracker.enterLayer(it);
678 691
679 if (it.representsTargetRenderSurface()) { 692 if (it.representsTargetRenderSurface()) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 803 {
791 if (deviceScaleFactor == m_deviceScaleFactor) 804 if (deviceScaleFactor == m_deviceScaleFactor)
792 return; 805 return;
793 m_deviceScaleFactor = deviceScaleFactor; 806 m_deviceScaleFactor = deviceScaleFactor;
794 807
795 setNeedsCommit(); 808 setNeedsCommit();
796 } 809 }
797 810
798 void LayerTreeHost::animateLayers(base::TimeTicks time) 811 void LayerTreeHost::animateLayers(base::TimeTicks time)
799 { 812 {
800 if (!Settings::acceleratedAnimationEnabled() || !m_needsAnimateLayers) 813 if (!m_settings.acceleratedAnimationEnabled || !m_needsAnimateLayers)
801 return; 814 return;
802 815
803 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); 816 TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers");
804 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), time); 817 m_needsAnimateLayers = animateLayersRecursive(m_rootLayer.get(), time);
805 } 818 }
806 819
807 bool LayerTreeHost::animateLayersRecursive(Layer* current, base::TimeTicks time) 820 bool LayerTreeHost::animateLayersRecursive(Layer* current, base::TimeTicks time)
808 { 821 {
809 if (!current) 822 if (!current)
810 return false; 823 return false;
(...skipping 27 matching lines...) Expand all
838 else 851 else
839 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 852 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
840 } 853 }
841 } 854 }
842 855
843 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 856 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
844 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 857 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
845 } 858 }
846 859
847 } // namespace cc 860 } // 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