Don't hide PopupZoomer if the content size didn't change.
[chromium-blink-merge.git] / cc / rate_limiter.cc
blob2c5cbabf8f9e8c9bbcb418b9f11d50bd3269c7f2
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"
8 #include "cc/thread.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
11 namespace cc {
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)
19 : m_thread(thread)
20 , m_context(context)
21 , m_active(false)
22 , m_client(client)
24 DCHECK(context);
27 RateLimiter::~RateLimiter()
31 void RateLimiter::start()
33 if (m_active)
34 return;
36 TRACE_EVENT0("cc", "RateLimiter::start");
37 m_active = true;
38 m_thread->postTask(base::Bind(&RateLimiter::rateLimitContext, this));
41 void RateLimiter::stop()
43 TRACE_EVENT0("cc", "RateLimiter::stop");
44 m_client = 0;
47 void RateLimiter::rateLimitContext()
49 if (!m_client)
50 return;
52 TRACE_EVENT0("cc", "RateLimiter::rateLimitContext");
54 m_active = false;
55 m_client->rateLimit();
56 m_context->rateLimitOffscreenContextCHROMIUM();
59 } // namespace cc