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

Side by Side Diff: cc/layer_tree_host_impl.cc

Issue 12194015: cc: Rasterize cheap tiles immediately (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased. Created 7 years, 10 months 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
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 30 matching lines...) Expand all
41 #include "cc/solid_color_draw_quad.h" 41 #include "cc/solid_color_draw_quad.h"
42 #include "cc/texture_uploader.h" 42 #include "cc/texture_uploader.h"
43 #include "cc/top_controls_manager.h" 43 #include "cc/top_controls_manager.h"
44 #include "cc/tree_synchronizer.h" 44 #include "cc/tree_synchronizer.h"
45 #include "cc/util.h" 45 #include "cc/util.h"
46 #include "ui/gfx/size_conversions.h" 46 #include "ui/gfx/size_conversions.h"
47 #include "ui/gfx/vector2d_conversions.h" 47 #include "ui/gfx/vector2d_conversions.h"
48 48
49 namespace { 49 namespace {
50 50
51 // Limits for the total number of cheap tile rasterizations we are allowed to
52 // perform during a single frame and the time spent rasterizing.
53 // TODO(skyostil): Determine these limits more dynamically.
54 const int kMaxCheapRasterCount = 6;
55 const int kMaxCheapRasterMilliseconds = 6;
56
51 void didVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) 57 void didVisibilityChange(cc::LayerTreeHostImpl* id, bool visible)
52 { 58 {
53 if (visible) { 59 if (visible) {
54 TRACE_EVENT_ASYNC_BEGIN1("webkit", "LayerTreeHostImpl::setVisible", id, "LayerTreeHostImpl", id); 60 TRACE_EVENT_ASYNC_BEGIN1("webkit", "LayerTreeHostImpl::setVisible", id, "LayerTreeHostImpl", id);
55 return; 61 return;
56 } 62 }
57 63
58 TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::setVisible", id); 64 TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::setVisible", id);
59 } 65 }
60 66
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 , m_memoryHistory(MemoryHistory::create()) 158 , m_memoryHistory(MemoryHistory::create())
153 , m_debugRectHistory(DebugRectHistory::create()) 159 , m_debugRectHistory(DebugRectHistory::create())
154 , m_numImplThreadScrolls(0) 160 , m_numImplThreadScrolls(0)
155 , m_numMainThreadScrolls(0) 161 , m_numMainThreadScrolls(0)
156 , m_cumulativeNumLayersDrawn(0) 162 , m_cumulativeNumLayersDrawn(0)
157 , m_cumulativeNumMissingTiles(0) 163 , m_cumulativeNumMissingTiles(0)
158 , m_lastSentMemoryVisibleBytes(0) 164 , m_lastSentMemoryVisibleBytes(0)
159 , m_lastSentMemoryVisibleAndNearbyBytes(0) 165 , m_lastSentMemoryVisibleAndNearbyBytes(0)
160 , m_lastSentMemoryUseBytes(0) 166 , m_lastSentMemoryUseBytes(0)
161 , m_animationRegistrar(AnimationRegistrar::create()) 167 , m_animationRegistrar(AnimationRegistrar::create())
168 , m_cheapRasterCount(0)
162 { 169 {
163 DCHECK(m_proxy->isImplThread()); 170 DCHECK(m_proxy->isImplThread());
164 didVisibilityChange(this, m_visible); 171 didVisibilityChange(this, m_visible);
165 172
166 if (settings.calculateTopControlsPosition) 173 if (settings.calculateTopControlsPosition)
167 m_topControlsManager = TopControlsManager::Create(this, settings.topCont rolsHeight); 174 m_topControlsManager = TopControlsManager::Create(this, settings.topCont rolsHeight);
168 175
169 setDebugState(settings.initialDebugState); 176 setDebugState(settings.initialDebugState);
170 177
171 // LTHI always has an active tree. 178 // LTHI always has an active tree.
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 if (m_client) 715 if (m_client)
709 m_client->setNeedsManageTilesOnImplThread(); 716 m_client->setNeedsManageTilesOnImplThread();
710 } 717 }
711 718
712 void LayerTreeHostImpl::DidUploadVisibleHighResolutionTile() 719 void LayerTreeHostImpl::DidUploadVisibleHighResolutionTile()
713 { 720 {
714 if (m_client) 721 if (m_client)
715 m_client->didUploadVisibleHighResolutionTileOnImplThread(); 722 m_client->didUploadVisibleHighResolutionTileOnImplThread();
716 } 723 }
717 724
725 bool LayerTreeHostImpl::CanDoAnotherCheapRaster() const
726 {
727 DCHECK(m_settings.useCheapnessEstimator);
728 if (m_cheapRasterCount >= kMaxCheapRasterCount) {
729 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDoAnotherCheapRaster d id too many");
730 return false;
731 }
732 if (m_cheapRasterDeadline.is_null() || base::TimeTicks::Now() >= m_cheapRast erDeadline) {
733 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDoAnotherCheapRaster o ut of time");
734 m_cheapRasterDeadline = base::TimeTicks();
735 return false;
736 }
737 return true;
738 }
739
740 void LayerTreeHostImpl::DidPerformCheapRaster()
741 {
742 DCHECK(m_settings.useCheapnessEstimator);
743 m_cheapRasterCount++;
744 DCHECK(m_cheapRasterCount <= kMaxCheapRasterCount);
745 }
746
718 bool LayerTreeHostImpl::shouldClearRootRenderPass() const 747 bool LayerTreeHostImpl::shouldClearRootRenderPass() const
719 { 748 {
720 return m_settings.shouldClearRootRenderPass; 749 return m_settings.shouldClearRootRenderPass;
721 } 750 }
722 751
723 void LayerTreeHostImpl::setManagedMemoryPolicy(const ManagedMemoryPolicy& policy ) 752 void LayerTreeHostImpl::setManagedMemoryPolicy(const ManagedMemoryPolicy& policy )
724 { 753 {
725 if (m_managedMemoryPolicy == policy) 754 if (m_managedMemoryPolicy == policy)
726 return; 755 return;
727 756
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 return m_renderer && m_renderer->isContextLost(); 869 return m_renderer && m_renderer->isContextLost();
841 } 870 }
842 871
843 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const 872 const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
844 { 873 {
845 return m_renderer->capabilities(); 874 return m_renderer->capabilities();
846 } 875 }
847 876
848 bool LayerTreeHostImpl::swapBuffers() 877 bool LayerTreeHostImpl::swapBuffers()
849 { 878 {
879 if (m_settings.useCheapnessEstimator) {
880 m_cheapRasterCount = 0;
881 m_cheapRasterDeadline = base::TimeTicks::Now() + base::TimeDelta::FromMi lliseconds(kMaxCheapRasterMilliseconds);
882 }
850 return m_renderer->swapBuffers(); 883 return m_renderer->swapBuffers();
851 } 884 }
852 885
853 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const 886 const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const
854 { 887 {
855 return m_deviceViewportSize; 888 return m_deviceViewportSize;
856 } 889 }
857 890
858 const LayerTreeSettings& LayerTreeHostImpl::settings() const 891 const LayerTreeSettings& LayerTreeHostImpl::settings() const
859 { 892 {
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 if (m_tileManager) 1761 if (m_tileManager)
1729 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ()); 1762 m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats ());
1730 } 1763 }
1731 1764
1732 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime) 1765 void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime)
1733 { 1766 {
1734 m_paintTimeCounter->SavePaintTime(totalPaintTime); 1767 m_paintTimeCounter->SavePaintTime(totalPaintTime);
1735 } 1768 }
1736 1769
1737 } // namespace cc 1770 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/picture.h » ('j') | cc/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698