OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 #if USE(ACCELERATED_COMPOSITING) | 29 #if USE(ACCELERATED_COMPOSITING) |
30 | 30 |
31 #include "Timer.h" | 31 #include "Timer.h" |
32 #include <wtf/RefCounted.h> | 32 #include <wtf/RefCounted.h> |
33 #include <wtf/RefPtr.h> | 33 #include <wtf/RefPtr.h> |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 class GraphicsContext3D; | 37 class GraphicsContext3D; |
38 | 38 |
| 39 class RateLimiterClient { |
| 40 public: |
| 41 virtual void rateLimit() = 0; |
| 42 }; |
| 43 |
39 // A class containing a timer, which calls rateLimitCHROMIUM on expiry | 44 // A class containing a timer, which calls rateLimitCHROMIUM on expiry |
40 class RateLimiter : public RefCounted<RateLimiter> { | 45 class RateLimiter : public RefCounted<RateLimiter> { |
41 public: | 46 public: |
42 static PassRefPtr<RateLimiter> create(GraphicsContext3D*); | 47 static PassRefPtr<RateLimiter> create(GraphicsContext3D*, RateLimiterClient*
); |
43 ~RateLimiter(); | 48 ~RateLimiter(); |
44 | 49 |
45 void start(); | 50 void start(); |
46 void stop(); | 51 void stop(); |
47 | 52 |
48 private: | 53 private: |
49 explicit RateLimiter(GraphicsContext3D*); | 54 RateLimiter(GraphicsContext3D*, RateLimiterClient*); |
50 RefPtr<GraphicsContext3D> m_context; | 55 RefPtr<GraphicsContext3D> m_context; |
51 bool m_contextSupportsRateLimitingExtension; | 56 bool m_contextSupportsRateLimitingExtension; |
52 Timer<RateLimiter> m_timer; | 57 Timer<RateLimiter> m_timer; |
53 void rateLimitContext(Timer<RateLimiter>*); | 58 void rateLimitContext(Timer<RateLimiter>*); |
| 59 RateLimiterClient *m_client; |
54 }; | 60 }; |
55 | 61 |
56 } | 62 } |
57 #endif // USE(ACCELERATED_COMPOSITING) | 63 #endif // USE(ACCELERATED_COMPOSITING) |
58 | 64 |
59 #endif | 65 #endif |
OLD | NEW |