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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11414017: cc: handling debug settings in new LayerTreeDebugState structure (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rewrote to LayerTreeSwitches 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
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_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "cc/append_quads_data.h" 11 #include "cc/append_quads_data.h"
12 #include "cc/damage_tracker.h" 12 #include "cc/damage_tracker.h"
13 #include "cc/debug_rect_history.h" 13 #include "cc/debug_rect_history.h"
14 #include "cc/delay_based_time_source.h" 14 #include "cc/delay_based_time_source.h"
15 #include "cc/font_atlas.h"
16 #include "cc/frame_rate_counter.h" 15 #include "cc/frame_rate_counter.h"
17 #include "cc/gl_renderer.h" 16 #include "cc/gl_renderer.h"
18 #include "cc/heads_up_display_layer_impl.h" 17 #include "cc/heads_up_display_layer_impl.h"
19 #include "cc/layer_iterator.h" 18 #include "cc/layer_iterator.h"
20 #include "cc/layer_tree_host.h" 19 #include "cc/layer_tree_host.h"
21 #include "cc/layer_tree_host_common.h" 20 #include "cc/layer_tree_host_common.h"
22 #include "cc/math_util.h" 21 #include "cc/math_util.h"
23 #include "cc/overdraw_metrics.h" 22 #include "cc/overdraw_metrics.h"
24 #include "cc/page_scale_animation.h" 23 #include "cc/page_scale_animation.h"
25 #include "cc/prioritized_resource_manager.h" 24 #include "cc/prioritized_resource_manager.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy) 202 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy)
204 : m_client(client) 203 : m_client(client)
205 , m_proxy(proxy) 204 , m_proxy(proxy)
206 , m_sourceFrameNumber(-1) 205 , m_sourceFrameNumber(-1)
207 , m_rootScrollLayerImpl(0) 206 , m_rootScrollLayerImpl(0)
208 , m_currentlyScrollingLayerImpl(0) 207 , m_currentlyScrollingLayerImpl(0)
209 , m_hudLayerImpl(0) 208 , m_hudLayerImpl(0)
210 , m_scrollingLayerIdFromPreviousTree(-1) 209 , m_scrollingLayerIdFromPreviousTree(-1)
211 , m_scrollDeltaIsInViewportSpace(false) 210 , m_scrollDeltaIsInViewportSpace(false)
212 , m_settings(settings) 211 , m_settings(settings)
212 , m_switches(settings.initialSwitchSettings)
213 , m_deviceScaleFactor(1) 213 , m_deviceScaleFactor(1)
214 , m_visible(true) 214 , m_visible(true)
215 , m_contentsTexturesPurged(false) 215 , m_contentsTexturesPurged(false)
216 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), 216 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(),
217 PriorityCalculator::allowEverythingCutoff(), 217 PriorityCalculator::allowEverythingCutoff(),
218 0, 218 0,
219 PriorityCalculator::allowNothingCutoff()) 219 PriorityCalculator::allowNothingCutoff())
220 , m_backgroundColor(0) 220 , m_backgroundColor(0)
221 , m_hasTransparentBackground(false) 221 , m_hasTransparentBackground(false)
222 , m_needsAnimateLayers(false) 222 , m_needsAnimateLayers(false)
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // Create the render passes in dependency order. 480 // Create the render passes in dependency order.
481 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) { 481 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) {
482 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex]; 482 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex];
483 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); 483 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame);
484 } 484 }
485 485
486 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); 486 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
487 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont entRect(), recordMetricsForFrame); 487 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont entRect(), recordMetricsForFrame);
488 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize); 488 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize);
489 489
490 if (settings().showOccludingRects) 490 if (m_switches.showOccludingRects)
491 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS creenSpaceRects); 491 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS creenSpaceRects);
492 if (settings().showNonOccludingRects) 492 if (m_switches.showNonOccludingRects)
493 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.nonOccl udingScreenSpaceRects); 493 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.nonOccl udingScreenSpaceRects);
494 494
495 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk. 495 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk.
496 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; 496 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
497 497
498 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being 498 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being
499 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing 499 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing
500 // in the future. 500 // in the future.
501 bool drawFrame = true; 501 bool drawFrame = true;
502 502
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 { 787 {
788 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); 788 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers");
789 DCHECK(canDraw()); 789 DCHECK(canDraw());
790 DCHECK(!frame.renderPasses.empty()); 790 DCHECK(!frame.renderPasses.empty());
791 791
792 // FIXME: use the frame begin time from the overall compositor scheduler. 792 // FIXME: use the frame begin time from the overall compositor scheduler.
793 // This value is currently inaccessible because it is up in Chromium's 793 // This value is currently inaccessible because it is up in Chromium's
794 // RenderWidget. 794 // RenderWidget.
795 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); 795 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now());
796 796
797 if (m_settings.showDebugRects()) 797 if (m_switches.showHudRects())
798 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, settings()); 798 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, m_switches);
799 799
800 // Because the contents of the HUD depend on everything else in the frame, t he contents 800 // Because the contents of the HUD depend on everything else in the frame, t he contents
801 // of its texture are updated as the last thing before the frame is drawn. 801 // of its texture are updated as the last thing before the frame is drawn.
802 if (m_hudLayerImpl) 802 if (m_hudLayerImpl && m_switches.showHudInfo())
803 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); 803 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get());
804 804
805 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); 805 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById);
806 806
807 // Once a RenderPass has been drawn, its damage should be cleared in 807 // Once a RenderPass has been drawn, its damage should be cleared in
808 // case the RenderPass will be reused next frame. 808 // case the RenderPass will be reused next frame.
809 for (unsigned int i = 0; i < frame.renderPasses.size(); i++) 809 for (unsigned int i = 0; i < frame.renderPasses.size(); i++)
810 frame.renderPasses[i]->damage_rect = gfx::RectF(); 810 frame.renderPasses[i]->damage_rect = gfx::RectF();
811 811
812 // The next frame should start by assuming nothing has changed, and changes are noted as they occur. 812 // The next frame should start by assuming nothing has changed, and changes are noted as they occur.
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1589 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1590 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); 1590 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
1591 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1591 if (scrollbarController && scrollbarController->animate(monotonicTime))
1592 m_client->setNeedsRedrawOnImplThread(); 1592 m_client->setNeedsRedrawOnImplThread();
1593 1593
1594 for (size_t i = 0; i < layer->children().size(); ++i) 1594 for (size_t i = 0; i < layer->children().size(); ++i)
1595 animateScrollbarsRecursive(layer->children()[i], time); 1595 animateScrollbarsRecursive(layer->children()[i], time);
1596 } 1596 }
1597 1597
1598 } // namespace cc 1598 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698