summaryrefslogtreecommitdiffstats
path: root/cc/layer_tree_host.h
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 18:55:18 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 18:55:18 +0000
commitacb854064f1168aebf88073b00668250d05ae5ad (patch)
tree67855be8aa82c26908fc7359567426d338784251 /cc/layer_tree_host.h
parent2c273bde541166189f3c2afc0655710cb445bdaa (diff)
downloadchromium_src-acb854064f1168aebf88073b00668250d05ae5ad.zip
chromium_src-acb854064f1168aebf88073b00668250d05ae5ad.tar.gz
chromium_src-acb854064f1168aebf88073b00668250d05ae5ad.tar.bz2
Throttle prepaints to avoid colliding with post-load work
On the page cyclers (especially intl1) the prepaint logic in the compositor interferes with the subsequent page's load time when --force-compositing-mode is active. This is because the prepaint schedules a commit immediately after finishing a prepaint-eligible paint. On the page cyclers, this means that we frequently do a second commit just after starting the load on the next page in the set since the new page's URL is set just after the onload event. This patch tweaks the prepaint to happen only after we perform an updateLayers() that's prepaint eligible and then go 100ms (number picked somewhat arbitrarily) without receiving another setNeedsCommit(). The goal is to only prepaint if the compositor scene is roughly steady - if we're still receiving invalidations on the main content then it's less likely that prepainting will be useful. On pages in the wild that load quickly, the first prepaint after first paint is likely to collide with onload and shortly-after-onload logic. Delaying until we reach a steady state shouldn't slow down static pages but will help avoid contention and wasted work on pages that modify the page on or shortly after onload. BUG=152355 Review URL: https://chromiumcodereview.appspot.com/11273029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_tree_host.h')
-rw-r--r--cc/layer_tree_host.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h
index c80e79d..88f625e 100644
--- a/cc/layer_tree_host.h
+++ b/cc/layer_tree_host.h
@@ -9,6 +9,7 @@
#include "IntRect.h"
#include "base/basictypes.h"
+#include "base/cancelable_callback.h"
#include "base/hash_tables.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -218,6 +219,7 @@ private:
bool paintMasksForRenderSurface(Layer*, TextureUpdateQueue&);
void updateLayers(Layer*, TextureUpdateQueue&);
+ void triggerPrepaint();
void prioritizeTextures(const LayerList&, OverdrawMetrics&);
void setPrioritiesForSurfaces(size_t surfaceMemoryBytes);
@@ -231,6 +233,8 @@ private:
bool m_animating;
bool m_needsAnimateLayers;
+ base::CancelableClosure m_prepaintCallback;
+
LayerTreeHostClient* m_client;
int m_commitNumber;