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

Side by Side Diff: cc/scheduler/rate_limiter.h

Issue 51653008: Remove WGC3D::isContextLost references from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 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 | Annotate | Revision Log
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_SCHEDULER_RATE_LIMITER_H_ 5 #ifndef CC_SCHEDULER_RATE_LIMITER_H_
6 #define CC_SCHEDULER_RATE_LIMITER_H_ 6 #define CC_SCHEDULER_RATE_LIMITER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 9
10 namespace base { class SingleThreadTaskRunner; } 10 namespace base { class SingleThreadTaskRunner; }
11 11
12 namespace WebKit { class WebGraphicsContext3D; }
13
14 namespace cc { 12 namespace cc {
13 class TextureLayerClient;
15 14
16 class RateLimiterClient { 15 class RateLimiterClient {
17 public: 16 public:
18 virtual void RateLimit() = 0; 17 virtual void RateLimit() = 0;
19 18
20 protected: 19 protected:
21 virtual ~RateLimiterClient() {} 20 virtual ~RateLimiterClient() {}
22 }; 21 };
23 22
24 // A RateLimiter can be used to make sure that a single context does not 23 // A RateLimiter can be used to make sure that a single TextureLayerClient's
25 // dominate all execution time. To use, construct a RateLimiter class around 24 // context does not dominate all execution time. To use, construct a
26 // the context and call Start() whenever calls are made on the context outside 25 // RateLimiter class around the client and call Start() whenever calls are made
27 // of normal flow control. RateLimiter will block if the context is too far 26 // on the context outside of normal flow control. RateLimiter will block if the
28 // ahead of the compositor. 27 // context is too far ahead of the compositor.
29 class RateLimiter : public base::RefCounted<RateLimiter> { 28 class RateLimiter : public base::RefCounted<RateLimiter> {
30 public: 29 public:
31 static scoped_refptr<RateLimiter> Create( 30 static scoped_refptr<RateLimiter> Create(
32 WebKit::WebGraphicsContext3D* context, 31 TextureLayerClient* texture_layer_client,
33 RateLimiterClient* client, 32 RateLimiterClient* client,
34 base::SingleThreadTaskRunner* task_runner); 33 base::SingleThreadTaskRunner* task_runner);
35 34
36 void Start(); 35 void Start();
37 36
38 // Context and client will not be accessed after Stop(). 37 // Context and client will not be accessed after Stop().
39 void Stop(); 38 void Stop();
40 39
41 private: 40 private:
42 friend class base::RefCounted<RateLimiter>; 41 friend class base::RefCounted<RateLimiter>;
43 42
44 RateLimiter(WebKit::WebGraphicsContext3D* context, 43 RateLimiter(TextureLayerClient* texture_layer_client,
45 RateLimiterClient* client, 44 RateLimiterClient* client,
46 base::SingleThreadTaskRunner* task_runner); 45 base::SingleThreadTaskRunner* task_runner);
47 ~RateLimiter(); 46 ~RateLimiter();
48 47
49 void RateLimitContext(); 48 void RateLimitContext();
50 49
51 WebKit::WebGraphicsContext3D* context_; 50 TextureLayerClient* texture_layer_client_;
52 bool active_; 51 bool active_;
53 RateLimiterClient* client_; 52 RateLimiterClient* client_;
54 base::SingleThreadTaskRunner* task_runner_; 53 base::SingleThreadTaskRunner* task_runner_;
55 54
56 DISALLOW_COPY_AND_ASSIGN(RateLimiter); 55 DISALLOW_COPY_AND_ASSIGN(RateLimiter);
57 }; 56 };
58 57
59 } // namespace cc 58 } // namespace cc
60 59
61 #endif // CC_SCHEDULER_RATE_LIMITER_H_ 60 #endif // CC_SCHEDULER_RATE_LIMITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698