OLD | NEW |
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 CCProxy_h | 5 #ifndef CCProxy_h |
6 #define CCProxy_h | 6 #define CCProxy_h |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/logging.h" |
9 #include <public/WebCompositorOutputSurface.h> | 10 #include <public/WebCompositorOutputSurface.h> |
10 #include <wtf/PassOwnPtr.h> | 11 #include <wtf/PassOwnPtr.h> |
11 #include <wtf/PassRefPtr.h> | 12 #include <wtf/PassRefPtr.h> |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 class CCThread; | 16 class CCThread; |
16 class IntRect; | 17 class IntRect; |
17 class IntSize; | 18 class IntSize; |
18 struct CCRenderingStats; | 19 struct CCRenderingStats; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Forces 3D commands on all contexts to wait for all previous SwapBuffers t
o finish before executing in the GPU | 77 // Forces 3D commands on all contexts to wait for all previous SwapBuffers t
o finish before executing in the GPU |
77 // process. | 78 // process. |
78 virtual void forceSerializeOnSwapBuffers() = 0; | 79 virtual void forceSerializeOnSwapBuffers() = 0; |
79 | 80 |
80 // Maximum number of sub-region texture updates supported for each commit. | 81 // Maximum number of sub-region texture updates supported for each commit. |
81 virtual size_t maxPartialTextureUpdates() const = 0; | 82 virtual size_t maxPartialTextureUpdates() const = 0; |
82 | 83 |
83 virtual void acquireLayerTextures() = 0; | 84 virtual void acquireLayerTextures() = 0; |
84 | 85 |
85 // Debug hooks | 86 // Debug hooks |
86 #ifndef NDEBUG | |
87 static bool isMainThread(); | 87 static bool isMainThread(); |
88 static bool isImplThread(); | 88 static bool isImplThread(); |
89 static bool isMainThreadBlocked(); | 89 static bool isMainThreadBlocked(); |
90 static void setMainThreadBlocked(bool); | 90 static void setMainThreadBlocked(bool); |
91 #endif | |
92 | 91 |
93 // Testing hooks | 92 // Testing hooks |
94 virtual void loseContext() = 0; | 93 virtual void loseContext() = 0; |
95 | 94 |
96 #ifndef NDEBUG | |
97 static void setCurrentThreadIsImplThread(bool); | 95 static void setCurrentThreadIsImplThread(bool); |
98 #endif | |
99 | 96 |
100 protected: | 97 protected: |
101 CCProxy(); | 98 CCProxy(); |
102 friend class DebugScopedSetImplThread; | 99 friend class DebugScopedSetImplThread; |
103 friend class DebugScopedSetMainThreadBlocked; | 100 friend class DebugScopedSetMainThreadBlocked; |
104 | 101 |
105 private: | 102 private: |
106 DISALLOW_COPY_AND_ASSIGN(CCProxy); | 103 DISALLOW_COPY_AND_ASSIGN(CCProxy); |
107 }; | 104 }; |
108 | 105 |
109 class DebugScopedSetMainThreadBlocked { | 106 class DebugScopedSetMainThreadBlocked { |
110 public: | 107 public: |
111 DebugScopedSetMainThreadBlocked() | 108 DebugScopedSetMainThreadBlocked() |
112 { | 109 { |
113 #if !ASSERT_DISABLED | 110 DCHECK(!CCProxy::isMainThreadBlocked()); |
114 ASSERT(!CCProxy::isMainThreadBlocked()); | |
115 CCProxy::setMainThreadBlocked(true); | 111 CCProxy::setMainThreadBlocked(true); |
116 #endif | |
117 } | 112 } |
118 ~DebugScopedSetMainThreadBlocked() | 113 ~DebugScopedSetMainThreadBlocked() |
119 { | 114 { |
120 #if !ASSERT_DISABLED | 115 DCHECK(CCProxy::isMainThreadBlocked()); |
121 ASSERT(CCProxy::isMainThreadBlocked()); | |
122 CCProxy::setMainThreadBlocked(false); | 116 CCProxy::setMainThreadBlocked(false); |
123 #endif | |
124 } | 117 } |
125 }; | 118 }; |
126 | 119 |
127 } | 120 } |
128 | 121 |
129 #endif | 122 #endif |
OLD | NEW |