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

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: 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"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // Create the render passes in dependency order. 380 // Create the render passes in dependency order.
381 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) { 381 for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceInd ex >= 0 ; --surfaceIndex) {
382 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex]; 382 LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceI ndex];
383 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame); 383 renderSurfaceLayer->renderSurface()->appendRenderPasses(frame);
384 } 384 }
385 385
386 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); 386 bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug ::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
387 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont entRect(), recordMetricsForFrame); 387 OcclusionTrackerImpl occlusionTracker(m_rootLayerImpl->renderSurface()->cont entRect(), recordMetricsForFrame);
388 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize); 388 occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingS ize);
389 389
390 if (settings().showOccludingRects) 390 if (m_hudLayerImpl) {
391 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingS creenSpaceRects); 391 if (m_hudLayerImpl->flags().showOccludingRects)
392 if (settings().showNonOccludingRects) 392 occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occlud ingScreenSpaceRects);
393 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.nonOccl udingScreenSpaceRects); 393 if (m_hudLayerImpl->flags().showNonOccludingRects)
394 occlusionTracker.setNonOccludingScreenSpaceRectsContainer(&frame.non OccludingScreenSpaceRects);
395 }
394 396
395 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk. 397 // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk.
396 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType; 398 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
397 399
398 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being 400 // Typically when we are missing a texture and use a checkerboard quad, we s till draw the frame. However when the layer being
399 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing 401 // checkerboarded is moving due to an impl-animation, we drop the frame to a void flashing due to the texture suddenly appearing
400 // in the future. 402 // in the future.
401 bool drawFrame = true; 403 bool drawFrame = true;
402 404
403 LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList) ; 405 LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList) ;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 { 689 {
688 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); 690 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers");
689 DCHECK(canDraw()); 691 DCHECK(canDraw());
690 DCHECK(!frame.renderPasses.empty()); 692 DCHECK(!frame.renderPasses.empty());
691 693
692 // FIXME: use the frame begin time from the overall compositor scheduler. 694 // FIXME: use the frame begin time from the overall compositor scheduler.
693 // This value is currently inaccessible because it is up in Chromium's 695 // This value is currently inaccessible because it is up in Chromium's
694 // RenderWidget. 696 // RenderWidget.
695 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); 697 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now());
696 698
697 if (m_settings.showDebugRects())
698 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, settings());
699
700 // Because the contents of the HUD depend on everything else in the frame, t he contents 699 // Because the contents of the HUD depend on everything else in the frame, t he contents
701 // of its texture are updated as the last thing before the frame is drawn. 700 // of its texture are updated as the last thing before the frame is drawn.
702 if (m_hudLayerImpl) 701 if (m_hudLayerImpl) {
702 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, m_hudLayerImpl->flags());
703 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); 703 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get());
704 }
704 705
705 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); 706 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById);
706 707
707 // Once a RenderPass has been drawn, its damage should be cleared in 708 // Once a RenderPass has been drawn, its damage should be cleared in
708 // case the RenderPass will be reused next frame. 709 // case the RenderPass will be reused next frame.
709 for (unsigned int i = 0; i < frame.renderPasses.size(); i++) 710 for (unsigned int i = 0; i < frame.renderPasses.size(); i++)
710 frame.renderPasses[i]->setDamageRect(gfx::RectF()); 711 frame.renderPasses[i]->setDamageRect(gfx::RectF());
711 712
712 // The next frame should start by assuming nothing has changed, and changes are noted as they occur. 713 // The next frame should start by assuming nothing has changed, and changes are noted as they occur.
713 for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++) 714 for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++)
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1493 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1493 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); 1494 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
1494 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1495 if (scrollbarController && scrollbarController->animate(monotonicTime))
1495 m_client->setNeedsRedrawOnImplThread(); 1496 m_client->setNeedsRedrawOnImplThread();
1496 1497
1497 for (size_t i = 0; i < layer->children().size(); ++i) 1498 for (size_t i = 0; i < layer->children().size(); ++i)
1498 animateScrollbarsRecursive(layer->children()[i], time); 1499 animateScrollbarsRecursive(layer->children()[i], time);
1499 } 1500 }
1500 1501
1501 } // namespace cc 1502 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698