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/scheduler/rate_limiter.h"
7 #include "base/debug/trace_event.h"
8 #include "cc/base/thread.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
13 scoped_refptr
<RateLimiter
> RateLimiter::Create(
14 WebKit::WebGraphicsContext3D
* context
,
15 RateLimiterClient
* client
,
17 return make_scoped_refptr(new RateLimiter(context
, client
, thread
));
20 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D
* context
,
21 RateLimiterClient
* client
,
30 RateLimiter::~RateLimiter() {}
32 void RateLimiter::Start() {
36 TRACE_EVENT0("cc", "RateLimiter::Start");
38 thread_
->PostTask(base::Bind(&RateLimiter::RateLimitContext
, this));
41 void RateLimiter::Stop() {
42 TRACE_EVENT0("cc", "RateLimiter::Stop");
46 void RateLimiter::RateLimitContext() {
50 TRACE_EVENT0("cc", "RateLimiter::RateLimitContext");
54 context_
->rateLimitOffscreenContextCHROMIUM();