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
3 // found in the LICENSE file.
5 #include "cc/rate_limiter.h"
7 #include "base/debug/trace_event.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
13 scoped_refptr
<RateLimiter
> RateLimiter::create(WebKit::WebGraphicsContext3D
* context
, RateLimiterClient
*client
, Thread
* thread
)
15 return make_scoped_refptr(new RateLimiter(context
, client
, thread
));
18 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D
* context
, RateLimiterClient
*client
, Thread
* thread
)
27 RateLimiter::~RateLimiter()
31 void RateLimiter::start()
36 TRACE_EVENT0("cc", "RateLimiter::start");
38 m_thread
->postTask(base::Bind(&RateLimiter::rateLimitContext
, this));
41 void RateLimiter::stop()
43 TRACE_EVENT0("cc", "RateLimiter::stop");
47 void RateLimiter::rateLimitContext()
52 TRACE_EVENT0("cc", "RateLimiter::rateLimitContext");
55 m_client
->rateLimit();
56 m_context
->rateLimitOffscreenContextCHROMIUM();