OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SharedContextRateLimiter_h | 5 #ifndef SharedContextRateLimiter_h |
6 #define SharedContextRateLimiter_h | 6 #define SharedContextRateLimiter_h |
7 | 7 |
8 #include "public/platform/WebGraphicsContext3D.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Deque.h" | 10 #include "wtf/Deque.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
12 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
| 13 #include "wtf/PassOwnPtr.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class WebGraphicsContext3DProvider; | 17 class WebGraphicsContext3DProvider; |
17 | 18 |
18 // Purpose: to limit the amount of worked queued for execution | 19 // Purpose: to limit the amount of worked queued for execution |
19 // (backlog) on the GPU by blocking the main thread to allow the GPU | 20 // (backlog) on the GPU by blocking the main thread to allow the GPU |
20 // to catch up. The Prevents unsynchronized tight animation loops | 21 // to catch up. The Prevents unsynchronized tight animation loops |
21 // from cause a GPU denial of service. | 22 // from cause a GPU denial of service. |
22 // | 23 // |
(...skipping 16 matching lines...) Expand all Loading... |
39 USING_FAST_MALLOC(SharedContextRateLimiter); | 40 USING_FAST_MALLOC(SharedContextRateLimiter); |
40 WTF_MAKE_NONCOPYABLE(SharedContextRateLimiter); | 41 WTF_MAKE_NONCOPYABLE(SharedContextRateLimiter); |
41 public: | 42 public: |
42 static PassOwnPtr<SharedContextRateLimiter> create(unsigned maxPendingTicks)
; | 43 static PassOwnPtr<SharedContextRateLimiter> create(unsigned maxPendingTicks)
; |
43 void tick(); | 44 void tick(); |
44 void reset(); | 45 void reset(); |
45 private: | 46 private: |
46 SharedContextRateLimiter(unsigned maxPendingTicks); | 47 SharedContextRateLimiter(unsigned maxPendingTicks); |
47 | 48 |
48 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; | 49 OwnPtr<WebGraphicsContext3DProvider> m_contextProvider; |
49 Deque<WebGLId> m_queries; | 50 Deque<GLuint> m_queries; |
50 unsigned m_maxPendingTicks; | 51 unsigned m_maxPendingTicks; |
51 bool m_canUseSyncQueries; | 52 bool m_canUseSyncQueries; |
52 }; | 53 }; |
53 | 54 |
54 } // namespace blink | 55 } // namespace blink |
55 | 56 |
56 #endif | 57 #endif |
OLD | NEW |