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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/picture.h » ('j') | cc/tile_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 607a50c2344ce9bc1810702f5238d2507b535de4..5eee47e3803ba29969bcb886f2644345e0ea6253 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -48,6 +48,12 @@
namespace {
+// Limits for the total number of cheap tile rasterizations we are allowed to
+// perform during a single frame and the time spent rasterizing.
+// TODO(skyostil): Determine these limits more dynamically.
+const int kMaxCheapRasterCount = 6;
+const int kMaxCheapRasterMilliseconds = 6;
+
void didVisibilityChange(cc::LayerTreeHostImpl* id, bool visible)
{
if (visible) {
@@ -159,6 +165,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTre
, m_lastSentMemoryVisibleAndNearbyBytes(0)
, m_lastSentMemoryUseBytes(0)
, m_animationRegistrar(AnimationRegistrar::create())
+ , m_cheapRasterCount(0)
{
DCHECK(m_proxy->isImplThread());
didVisibilityChange(this, m_visible);
@@ -715,6 +722,28 @@ void LayerTreeHostImpl::DidUploadVisibleHighResolutionTile()
m_client->didUploadVisibleHighResolutionTileOnImplThread();
}
+bool LayerTreeHostImpl::CanDoAnotherCheapRaster() const
+{
+ DCHECK(m_settings.useCheapnessEstimator);
+ if (m_cheapRasterCount >= kMaxCheapRasterCount) {
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDoAnotherCheapRaster did too many");
+ return false;
+ }
+ if (m_cheapRasterDeadline.is_null() || base::TimeTicks::Now() >= m_cheapRasterDeadline) {
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDoAnotherCheapRaster out of time");
+ m_cheapRasterDeadline = base::TimeTicks();
+ return false;
+ }
+ return true;
+}
+
+void LayerTreeHostImpl::DidPerformCheapRaster()
+{
+ DCHECK(m_settings.useCheapnessEstimator);
+ m_cheapRasterCount++;
+ DCHECK(m_cheapRasterCount <= kMaxCheapRasterCount);
+}
+
bool LayerTreeHostImpl::shouldClearRootRenderPass() const
{
return m_settings.shouldClearRootRenderPass;
@@ -847,6 +876,10 @@ const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
bool LayerTreeHostImpl::swapBuffers()
{
+ if (m_settings.useCheapnessEstimator) {
+ m_cheapRasterCount = 0;
+ m_cheapRasterDeadline = base::TimeTicks::Now() + base::TimeDelta::FromMilliseconds(kMaxCheapRasterMilliseconds);
+ }
return m_renderer->swapBuffers();
}
« 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