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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 53153006: Simplify rate limiting since it's main thread shared context only (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index d93e3d5e032e80c8cf353b672338904f832a16f2..e3b5cfaee6547122b7338603c4244b3e5f8f6d5e 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -183,9 +183,6 @@ LayerTreeHost::~LayerTreeHost() {
}
s_num_layer_tree_instances--;
- RateLimiterMap::iterator it = rate_limiters_.begin();
- if (it != rate_limiters_.end())
- it->second->Stop();
if (root_layer_.get()) {
// The layer tree must be destroyed before the layer tree host. We've
@@ -1111,28 +1108,20 @@ void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) {
}
}
-void LayerTreeHost::StartRateLimiter(WebKit::WebGraphicsContext3D* context3d) {
+void LayerTreeHost::StartRateLimiter() {
if (animating_)
return;
- DCHECK(context3d);
- RateLimiterMap::iterator it = rate_limiters_.find(context3d);
- if (it != rate_limiters_.end()) {
- it->second->Start();
- } else {
- scoped_refptr<RateLimiter> rate_limiter =
- RateLimiter::Create(context3d, this, proxy_->MainThreadTaskRunner());
- rate_limiters_[context3d] = rate_limiter;
- rate_limiter->Start();
+ if (!rate_limit_timer_.IsRunning()) {
+ rate_limit_timer_.Start(FROM_HERE,
+ base::TimeDelta(),
+ this,
+ &LayerTreeHost::RateLimit);
}
}
-void LayerTreeHost::StopRateLimiter(WebKit::WebGraphicsContext3D* context3d) {
- RateLimiterMap::iterator it = rate_limiters_.find(context3d);
- if (it != rate_limiters_.end()) {
- it->second->Stop();
- rate_limiters_.erase(it);
- }
+void LayerTreeHost::StopRateLimiter() {
+ rate_limit_timer_.Stop();
}
void LayerTreeHost::RateLimit() {
@@ -1140,6 +1129,7 @@ void LayerTreeHost::RateLimit() {
// commands will wait for the compositing context, and therefore for the
// SwapBuffers.
proxy_->ForceSerializeOnSwapBuffers();
+ client_->RateLimitSharedMainThreadContext();
}
bool LayerTreeHost::AlwaysUsePartialTextureUpdates() {

Powered by Google App Engine
This is Rietveld 408576698