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 CCSingleThreadProxy_h | 5 #ifndef CCSingleThreadProxy_h |
6 #define CCSingleThreadProxy_h | 6 #define CCSingleThreadProxy_h |
7 | 7 |
8 #include "CCAnimationEvents.h" | 8 #include "CCAnimationEvents.h" |
9 #include "CCLayerTreeHostImpl.h" | 9 #include "CCLayerTreeHostImpl.h" |
10 #include "CCProxy.h" | 10 #include "CCProxy.h" |
11 #include <base/time.h> | 11 #include "base/time.h" |
12 #include <limits> | 12 #include <limits> |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 class CCLayerTreeHost; | 16 class CCLayerTreeHost; |
17 | 17 |
18 class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient { | 18 class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient { |
19 public: | 19 public: |
20 static scoped_ptr<CCProxy> create(CCLayerTreeHost*); | 20 static scoped_ptr<CCProxy> create(CCLayerTreeHost*); |
21 virtual ~CCSingleThreadProxy(); | 21 virtual ~CCSingleThreadProxy(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::TimeDelta m_totalCommitTime; | 83 base::TimeDelta m_totalCommitTime; |
84 size_t m_totalCommitCount; | 84 size_t m_totalCommitCount; |
85 }; | 85 }; |
86 | 86 |
87 // For use in the single-threaded case. In debug builds, it pretends that the | 87 // For use in the single-threaded case. In debug builds, it pretends that the |
88 // code is running on the impl thread to satisfy assertion checks. | 88 // code is running on the impl thread to satisfy assertion checks. |
89 class DebugScopedSetImplThread { | 89 class DebugScopedSetImplThread { |
90 public: | 90 public: |
91 DebugScopedSetImplThread() | 91 DebugScopedSetImplThread() |
92 { | 92 { |
93 #if !ASSERT_DISABLED | 93 #ifndef NDEBUG |
94 CCProxy::setCurrentThreadIsImplThread(true); | 94 CCProxy::setCurrentThreadIsImplThread(true); |
95 #endif | 95 #endif |
96 } | 96 } |
97 ~DebugScopedSetImplThread() | 97 ~DebugScopedSetImplThread() |
98 { | 98 { |
99 #if !ASSERT_DISABLED | 99 #ifndef NDEBUG |
100 CCProxy::setCurrentThreadIsImplThread(false); | 100 CCProxy::setCurrentThreadIsImplThread(false); |
101 #endif | 101 #endif |
102 } | 102 } |
103 }; | 103 }; |
104 | 104 |
105 // For use in the single-threaded case. In debug builds, it pretends that the | 105 // For use in the single-threaded case. In debug builds, it pretends that the |
106 // code is running on the main thread to satisfy assertion checks. | 106 // code is running on the main thread to satisfy assertion checks. |
107 class DebugScopedSetMainThread { | 107 class DebugScopedSetMainThread { |
108 public: | 108 public: |
109 DebugScopedSetMainThread() | 109 DebugScopedSetMainThread() |
110 { | 110 { |
111 #if !ASSERT_DISABLED | 111 #ifndef NDEBUG |
112 CCProxy::setCurrentThreadIsImplThread(false); | 112 CCProxy::setCurrentThreadIsImplThread(false); |
113 #endif | 113 #endif |
114 } | 114 } |
115 ~DebugScopedSetMainThread() | 115 ~DebugScopedSetMainThread() |
116 { | 116 { |
117 #if !ASSERT_DISABLED | 117 #ifndef NDEBUG |
118 CCProxy::setCurrentThreadIsImplThread(true); | 118 CCProxy::setCurrentThreadIsImplThread(true); |
119 #endif | 119 #endif |
120 } | 120 } |
121 }; | 121 }; |
122 | 122 |
123 // For use in the single-threaded case. In debug builds, it pretends that the | 123 // For use in the single-threaded case. In debug builds, it pretends that the |
124 // code is running on the impl thread and that the main thread is blocked to | 124 // code is running on the impl thread and that the main thread is blocked to |
125 // satisfy assertion checks | 125 // satisfy assertion checks |
126 class DebugScopedSetImplThreadAndMainThreadBlocked { | 126 class DebugScopedSetImplThreadAndMainThreadBlocked { |
127 private: | 127 private: |
128 DebugScopedSetImplThread m_implThread; | 128 DebugScopedSetImplThread m_implThread; |
129 DebugScopedSetMainThreadBlocked m_mainThreadBlocked; | 129 DebugScopedSetMainThreadBlocked m_mainThreadBlocked; |
130 }; | 130 }; |
131 | 131 |
132 } // namespace cc | 132 } // namespace cc |
133 | 133 |
134 #endif | 134 #endif |
OLD | NEW |