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

Side by Side Diff: cc/rate_limiter.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 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 unified diff | Download patch
« no previous file with comments | « cc/rate_limiter.h ('k') | cc/render_surface_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "cc/rate_limiter.h" 7 #include "cc/rate_limiter.h"
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/proxy.h"
11 #include "cc/thread.h" 10 #include "cc/thread.h"
12 #include <public/WebGraphicsContext3D.h> 11 #include <public/WebGraphicsContext3D.h>
13 12
14 namespace cc { 13 namespace cc {
15 14
16 scoped_refptr<RateLimiter> RateLimiter::create(WebKit::WebGraphicsContext3D* con text, RateLimiterClient *client) 15 scoped_refptr<RateLimiter> RateLimiter::create(WebKit::WebGraphicsContext3D* con text, RateLimiterClient *client, Thread* thread)
17 { 16 {
18 return make_scoped_refptr(new RateLimiter(context, client)); 17 return make_scoped_refptr(new RateLimiter(context, client, thread));
19 } 18 }
20 19
21 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context, RateLimiterClien t *client) 20 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context, RateLimiterClien t *client, Thread* thread)
22 : m_context(context) 21 : m_thread(thread)
22 , m_context(context)
23 , m_active(false) 23 , m_active(false)
24 , m_client(client) 24 , m_client(client)
25 { 25 {
26 DCHECK(context); 26 DCHECK(context);
27 } 27 }
28 28
29 RateLimiter::~RateLimiter() 29 RateLimiter::~RateLimiter()
30 { 30 {
31 } 31 }
32 32
33 void RateLimiter::start() 33 void RateLimiter::start()
34 { 34 {
35 if (m_active) 35 if (m_active)
36 return; 36 return;
37 37
38 TRACE_EVENT0("cc", "RateLimiter::start"); 38 TRACE_EVENT0("cc", "RateLimiter::start");
39 m_active = true; 39 m_active = true;
40 Proxy::mainThread()->postTask(base::Bind(&RateLimiter::rateLimitContext, thi s)); 40 m_thread->postTask(base::Bind(&RateLimiter::rateLimitContext, this));
41 } 41 }
42 42
43 void RateLimiter::stop() 43 void RateLimiter::stop()
44 { 44 {
45 TRACE_EVENT0("cc", "RateLimiter::stop"); 45 TRACE_EVENT0("cc", "RateLimiter::stop");
46 m_client = 0; 46 m_client = 0;
47 } 47 }
48 48
49 void RateLimiter::rateLimitContext() 49 void RateLimiter::rateLimitContext()
50 { 50 {
51 if (!m_client) 51 if (!m_client)
52 return; 52 return;
53 53
54 TRACE_EVENT0("cc", "RateLimiter::rateLimitContext"); 54 TRACE_EVENT0("cc", "RateLimiter::rateLimitContext");
55 55
56 m_active = false; 56 m_active = false;
57 m_client->rateLimit(); 57 m_client->rateLimit();
58 m_context->rateLimitOffscreenContextCHROMIUM(); 58 m_context->rateLimitOffscreenContextCHROMIUM();
59 } 59 }
60 60
61 } // namespace cc 61 } // namespace cc
OLDNEW
« no previous file with comments | « cc/rate_limiter.h ('k') | cc/render_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698