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

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: fixing tests Created 8 years 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy) 203 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre eHostImplClient* client, Proxy* proxy)
205 : m_client(client) 204 : m_client(client)
206 , m_proxy(proxy) 205 , m_proxy(proxy)
207 , m_sourceFrameNumber(-1) 206 , m_sourceFrameNumber(-1)
208 , m_rootScrollLayerImpl(0) 207 , m_rootScrollLayerImpl(0)
209 , m_currentlyScrollingLayerImpl(0) 208 , m_currentlyScrollingLayerImpl(0)
210 , m_hudLayerImpl(0) 209 , m_hudLayerImpl(0)
211 , m_scrollingLayerIdFromPreviousTree(-1) 210 , m_scrollingLayerIdFromPreviousTree(-1)
212 , m_scrollDeltaIsInViewportSpace(false) 211 , m_scrollDeltaIsInViewportSpace(false)
213 , m_settings(settings) 212 , m_settings(settings)
213 , m_debugState(settings.initialDebugState)
214 , m_deviceScaleFactor(1) 214 , m_deviceScaleFactor(1)
215 , m_visible(true) 215 , m_visible(true)
216 , m_contentsTexturesPurged(false) 216 , m_contentsTexturesPurged(false)
217 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(), 217 , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationL imit(),
218 PriorityCalculator::allowEverythingCutoff(), 218 PriorityCalculator::allowEverythingCutoff(),
219 0, 219 0,
220 PriorityCalculator::allowNothingCutoff()) 220 PriorityCalculator::allowNothingCutoff())
221 , m_backgroundColor(0) 221 , m_backgroundColor(0)
222 , m_hasTransparentBackground(false) 222 , m_hasTransparentBackground(false)
223 , m_needsAnimateLayers(false) 223 , m_needsAnimateLayers(false)
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // Create the render passes in dependency order. 483 // Create the render passes in dependency order.
484 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) { 484 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) {
485 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex]; 485 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex];
486 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); 486 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame);
487 } 487 }
488 488
489 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); 489 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
490 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont entRect(), recordMetricsForFrame); 490 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont entRect(), recordMetricsForFrame);
491 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize); 491 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize);
492 492
493 if (settings().showOccludingRects) 493 if (m_debugState.showOccludingRects)
494 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS creenSpaceRects); 494 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS creenSpaceRects);
495 if (settings().showNonOccludingRects) 495 if (m_debugState.showNonOccludingRects)
496 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.nonOccl udingScreenSpaceRects); 496 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.nonOccl udingScreenSpaceRects);
497 497
498 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk. 498 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk.
499 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; 499 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
500 500
501 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being 501 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being
502 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing 502 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing
503 // in the future. 503 // in the future.
504 bool drawFrame = true; 504 bool drawFrame = true;
505 505
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 790 {
791 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); 791 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers");
792 DCHECK(canDraw()); 792 DCHECK(canDraw());
793 DCHECK(!frame.renderPasses.empty()); 793 DCHECK(!frame.renderPasses.empty());
794 794
795 // FIXME: use the frame begin time from the overall compositor scheduler. 795 // FIXME: use the frame begin time from the overall compositor scheduler.
796 // This value is currently inaccessible because it is up in Chromium's 796 // This value is currently inaccessible because it is up in Chromium's
797 // RenderWidget. 797 // RenderWidget.
798 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); 798 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now());
799 799
800 if (m_settings.showDebugRects()) 800 if (m_debugState.showHudRects())
801 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, settings()); 801 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, m_debugState);
802 802
803 // Because the contents of the HUD depend on everything else in the frame, t he contents 803 // Because the contents of the HUD depend on everything else in the frame, t he contents
804 // of its texture are updated as the last thing before the frame is drawn. 804 // of its texture are updated as the last thing before the frame is drawn.
805 if (m_hudLayerImpl) 805 if (m_hudLayerImpl)
806 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); 806 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get());
807 807
808 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); 808 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById);
809 809
810 // Once a RenderPass has been drawn, its damage should be cleared in 810 // Once a RenderPass has been drawn, its damage should be cleared in
811 // case the RenderPass will be reused next frame. 811 // case the RenderPass will be reused next frame.
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1594 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1595 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); 1595 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
1596 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1596 if (scrollbarController && scrollbarController->animate(monotonicTime))
1597 m_client->setNeedsRedrawOnImplThread(); 1597 m_client->setNeedsRedrawOnImplThread();
1598 1598
1599 for (size_t i = 0; i < layer->children().size(); ++i) 1599 for (size_t i = 0; i < layer->children().size(); ++i)
1600 animateScrollbarsRecursive(layer->children()[i], time); 1600 animateScrollbarsRecursive(layer->children()[i], time);
1601 } 1601 }
1602 1602
1603 } // namespace cc 1603 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698