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

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 Dana's code review suggestions 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
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" 10 #include "cc/proxy.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 virtual void performTask() OVERRIDE 31 virtual void performTask() OVERRIDE
32 { 32 {
33 m_rateLimiter->rateLimitContext(); 33 m_rateLimiter->rateLimitContext();
34 } 34 }
35 35
36 scoped_refptr<RateLimiter> m_rateLimiter; 36 scoped_refptr<RateLimiter> m_rateLimiter;
37 }; 37 };
38 38
39 scoped_refptr<RateLimiter> RateLimiter::create(WebKit::WebGraphicsContext3D* con text, RateLimiterClient *client) 39 scoped_refptr<RateLimiter> RateLimiter::create(WebKit::WebGraphicsContext3D* con text, RateLimiterClient *client, Proxy* proxy)
40 { 40 {
41 return make_scoped_refptr(new RateLimiter(context, client)); 41 return make_scoped_refptr(new RateLimiter(context, client, proxy));
42 } 42 }
43 43
44 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context, RateLimiterClien t *client) 44 RateLimiter::RateLimiter(WebKit::WebGraphicsContext3D* context, RateLimiterClien t *client, Proxy* proxy)
45 : m_context(context) 45 : m_proxy(proxy)
46 , m_context(context)
46 , m_active(false) 47 , m_active(false)
47 , m_client(client) 48 , m_client(client)
48 { 49 {
49 DCHECK(context); 50 DCHECK(context);
50 } 51 }
51 52
52 RateLimiter::~RateLimiter() 53 RateLimiter::~RateLimiter()
53 { 54 {
54 } 55 }
55 56
56 void RateLimiter::start() 57 void RateLimiter::start()
57 { 58 {
58 if (m_active) 59 if (m_active)
59 return; 60 return;
60 61
61 TRACE_EVENT0("cc", "RateLimiter::start"); 62 TRACE_EVENT0("cc", "RateLimiter::start");
62 m_active = true; 63 m_active = true;
63 Proxy::mainThread()->postTask(RateLimiter::Task::create(this)); 64 m_proxy->mainThread()->postTask(RateLimiter::Task::create(this));
64 } 65 }
65 66
66 void RateLimiter::stop() 67 void RateLimiter::stop()
67 { 68 {
68 TRACE_EVENT0("cc", "RateLimiter::stop"); 69 TRACE_EVENT0("cc", "RateLimiter::stop");
69 m_client = 0; 70 m_client = 0;
70 } 71 }
71 72
72 void RateLimiter::rateLimitContext() 73 void RateLimiter::rateLimitContext()
73 { 74 {
74 if (!m_client) 75 if (!m_client)
75 return; 76 return;
76 77
77 TRACE_EVENT0("cc", "RateLimiter::rateLimitContext"); 78 TRACE_EVENT0("cc", "RateLimiter::rateLimitContext");
78 79
79 m_active = false; 80 m_active = false;
80 m_client->rateLimit(); 81 m_client->rateLimit();
81 m_context->rateLimitOffscreenContextCHROMIUM(); 82 m_context->rateLimitOffscreenContextCHROMIUM();
82 } 83 }
83 84
84 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698