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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 11419269: cc: Give ownership of render passes to the renderer when drawing a frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('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_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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 m_client->setNeedsCommitOnImplThread(); 809 m_client->setNeedsCommitOnImplThread();
810 } 810 }
811 811
812 void LayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, doubl e intervalInSeconds) 812 void LayerTreeHostImpl::onVSyncParametersChanged(double monotonicTimebase, doubl e intervalInSeconds)
813 { 813 {
814 base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimeb ase * base::Time::kMicrosecondsPerSecond); 814 base::TimeTicks timebase = base::TimeTicks::FromInternalValue(monotonicTimeb ase * base::Time::kMicrosecondsPerSecond);
815 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSecon ds * base::Time::kMicrosecondsPerSecond); 815 base::TimeDelta interval = base::TimeDelta::FromMicroseconds(intervalInSecon ds * base::Time::kMicrosecondsPerSecond);
816 m_client->onVSyncParametersChanged(timebase, interval); 816 m_client->onVSyncParametersChanged(timebase, interval);
817 } 817 }
818 818
819 void LayerTreeHostImpl::drawLayers(const FrameData& frame) 819 void LayerTreeHostImpl::drawLayers(FrameData& frame)
820 { 820 {
821 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers"); 821 TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers");
822 DCHECK(canDraw()); 822 DCHECK(canDraw());
823 DCHECK(!frame.renderPasses.empty()); 823 DCHECK(!frame.renderPasses.empty());
824 824
825 // FIXME: use the frame begin time from the overall compositor scheduler. 825 // FIXME: use the frame begin time from the overall compositor scheduler.
826 // This value is currently inaccessible because it is up in Chromium's 826 // This value is currently inaccessible because it is up in Chromium's
827 // RenderWidget. 827 // RenderWidget.
828 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now()); 828 m_fpsCounter->markBeginningOfFrame(base::TimeTicks::Now());
829 829
830 if (m_debugState.showHudRects()) 830 if (m_debugState.showHudRects())
831 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, m_debugState); 831 m_debugRectHistory->saveDebugRectsForCurrentFrame(m_rootLayerImpl.get(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOcclud ingScreenSpaceRects, m_debugState);
832 832
833 // Because the contents of the HUD depend on everything else in the frame, t he contents 833 // Because the contents of the HUD depend on everything else in the frame, t he contents
834 // of its texture are updated as the last thing before the frame is drawn. 834 // of its texture are updated as the last thing before the frame is drawn.
835 if (m_hudLayerImpl) 835 if (m_hudLayerImpl)
836 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get()); 836 m_hudLayerImpl->updateHudTexture(m_resourceProvider.get());
837 837
838 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById); 838 m_renderer->drawFrame(frame.renderPasses, frame.renderPassesById);
839 839
840 // Once a RenderPass has been drawn, its damage should be cleared in 840 // The render passes should be consumed by the renderer.
841 // case the RenderPass will be reused next frame. 841 DCHECK(frame.renderPasses.empty());
842 for (unsigned int i = 0; i < frame.renderPasses.size(); i++) 842 DCHECK(frame.renderPassesById.empty());
843 frame.renderPasses[i]->damage_rect = gfx::RectF();
844 843
845 // The next frame should start by assuming nothing has changed, and changes are noted as they occur. 844 // The next frame should start by assuming nothing has changed, and changes are noted as they occur.
846 for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++) 845 for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++)
847 (*frame.renderSurfaceLayerList)[i]->renderSurface()->damageTracker()->di dDrawDamagedArea(); 846 (*frame.renderSurfaceLayerList)[i]->renderSurface()->damageTracker()->di dDrawDamagedArea();
848 m_rootLayerImpl->resetAllChangeTrackingForSubtree(); 847 m_rootLayerImpl->resetAllChangeTrackingForSubtree();
849 } 848 }
850 849
851 void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame) 850 void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame)
852 { 851 {
853 for (size_t i = 0; i < frame.willDrawLayers.size(); ++i) 852 for (size_t i = 0; i < frame.willDrawLayers.size(); ++i)
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController(); 1631 ScrollbarAnimationController* scrollbarController = layer->scrollbarAnimatio nController();
1633 double monotonicTime = (time - base::TimeTicks()).InSecondsF(); 1632 double monotonicTime = (time - base::TimeTicks()).InSecondsF();
1634 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1633 if (scrollbarController && scrollbarController->animate(monotonicTime))
1635 m_client->setNeedsRedrawOnImplThread(); 1634 m_client->setNeedsRedrawOnImplThread();
1636 1635
1637 for (size_t i = 0; i < layer->children().size(); ++i) 1636 for (size_t i = 0; i < layer->children().size(); ++i)
1638 animateScrollbarsRecursive(layer->children()[i], time); 1637 animateScrollbarsRecursive(layer->children()[i], time);
1639 } 1638 }
1640 1639
1641 } // namespace cc 1640 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698