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

Side by Side Diff: cc/rate_limiter.h

Issue 12566033: cc: Chromify RateLimiter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/rate_limiter.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 #ifndef CC_RATE_LIMITER_H_ 5 #ifndef CC_RATE_LIMITER_H_
6 #define CC_RATE_LIMITER_H_ 6 #define CC_RATE_LIMITER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 9
10 namespace WebKit { 10 namespace WebKit { class WebGraphicsContext3D; }
11 class WebGraphicsContext3D;
12 }
13 11
14 namespace cc { 12 namespace cc {
15 13
16 class Thread; 14 class Thread;
17 15
18 class RateLimiterClient { 16 class RateLimiterClient {
19 public: 17 public:
20 virtual void rateLimit() = 0; 18 virtual void RateLimit() = 0;
21 }; 19 };
22 20
23 // A RateLimiter can be used to make sure that a single context does not dominat e all execution time. 21 // A RateLimiter can be used to make sure that a single context does not
24 // To use, construct a RateLimiter class around the context and call start() whe never calls are made on the 22 // dominate all execution time. To use, construct a RateLimiter class around
25 // context outside of normal flow control. RateLimiter will block if the context is too far ahead of the 23 // the context and call Start() whenever calls are made on the context outside
26 // compositor. 24 // of normal flow control. RateLimiter will block if the context is too far
25 // ahead of the compositor.
27 class RateLimiter : public base::RefCounted<RateLimiter> { 26 class RateLimiter : public base::RefCounted<RateLimiter> {
28 public: 27 public:
29 static scoped_refptr<RateLimiter> create(WebKit::WebGraphicsContext3D*, Rate LimiterClient*, Thread*); 28 static scoped_refptr<RateLimiter> Create(
29 WebKit::WebGraphicsContext3D* context,
30 RateLimiterClient* client,
31 Thread* thread);
30 32
31 void start(); 33 void Start();
32 34
33 // Context and client will not be accessed after stop(). 35 // Context and client will not be accessed after Stop().
34 void stop(); 36 void Stop();
35 37
36 private: 38 private:
37 RateLimiter(WebKit::WebGraphicsContext3D*, RateLimiterClient*, Thread*); 39 friend class base::RefCounted<RateLimiter>;
38 ~RateLimiter();
39 friend class base::RefCounted<RateLimiter>;
40 40
41 class Task; 41 RateLimiter(WebKit::WebGraphicsContext3D* context,
42 friend class Task; 42 RateLimiterClient* client,
43 void rateLimitContext(); 43 Thread* thread);
44 ~RateLimiter();
44 45
45 WebKit::WebGraphicsContext3D* m_context; 46 void RateLimitContext();
46 bool m_active; 47
47 RateLimiterClient *m_client; 48 WebKit::WebGraphicsContext3D* context_;
48 Thread* m_thread; 49 bool active_;
50 RateLimiterClient* client_;
51 Thread* thread_;
52
53 DISALLOW_COPY_AND_ASSIGN(RateLimiter);
49 }; 54 };
50 55
51 } 56 }
danakj 2013/03/14 16:38:28 // namespace cc
52 #endif // CC_RATE_LIMITER_H_ 57 #endif // CC_RATE_LIMITER_H_
OLDNEW
« no previous file with comments | « cc/layer_tree_host.cc ('k') | cc/rate_limiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698