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 CC_TREES_PROXY_H_ | 5 #ifndef CC_TREES_PROXY_H_ |
6 #define CC_TREES_PROXY_H_ | 6 #define CC_TREES_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Testing hooks | 110 // Testing hooks |
111 virtual bool CommitPendingForTesting() = 0; | 111 virtual bool CommitPendingForTesting() = 0; |
112 | 112 |
113 protected: | 113 protected: |
114 explicit Proxy(scoped_ptr<Thread> impl_thread); | 114 explicit Proxy(scoped_ptr<Thread> impl_thread); |
115 friend class DebugScopedSetImplThread; | 115 friend class DebugScopedSetImplThread; |
116 friend class DebugScopedSetMainThread; | 116 friend class DebugScopedSetMainThread; |
117 friend class DebugScopedSetMainThreadBlocked; | 117 friend class DebugScopedSetMainThreadBlocked; |
118 | 118 |
119 private: | 119 private: |
120 DISALLOW_COPY_AND_ASSIGN(Proxy); | |
121 | |
122 scoped_ptr<Thread> main_thread_; | 120 scoped_ptr<Thread> main_thread_; |
123 scoped_ptr<Thread> impl_thread_; | 121 scoped_ptr<Thread> impl_thread_; |
124 #ifndef NDEBUG | 122 #ifndef NDEBUG |
125 bool impl_thread_is_overridden_; | 123 bool impl_thread_is_overridden_; |
126 bool is_main_thread_blocked_; | 124 bool is_main_thread_blocked_; |
127 #endif | 125 #endif |
| 126 |
| 127 DISALLOW_COPY_AND_ASSIGN(Proxy); |
128 }; | 128 }; |
129 | 129 |
130 #ifndef NDEBUG | 130 #ifndef NDEBUG |
131 class DebugScopedSetMainThreadBlocked { | 131 class DebugScopedSetMainThreadBlocked { |
132 public: | 132 public: |
133 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) { | 133 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) { |
134 DCHECK(!proxy_->IsMainThreadBlocked()); | 134 DCHECK(!proxy_->IsMainThreadBlocked()); |
135 proxy_->SetMainThreadBlocked(true); | 135 proxy_->SetMainThreadBlocked(true); |
136 } | 136 } |
137 ~DebugScopedSetMainThreadBlocked() { | 137 ~DebugScopedSetMainThreadBlocked() { |
138 DCHECK(proxy_->IsMainThreadBlocked()); | 138 DCHECK(proxy_->IsMainThreadBlocked()); |
139 proxy_->SetMainThreadBlocked(false); | 139 proxy_->SetMainThreadBlocked(false); |
140 } | 140 } |
141 private: | 141 private: |
142 Proxy* proxy_; | 142 Proxy* proxy_; |
143 }; | 143 }; |
144 #else | 144 #else |
145 class DebugScopedSetMainThreadBlocked { | 145 class DebugScopedSetMainThreadBlocked { |
146 public: | 146 public: |
147 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} | 147 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} |
148 ~DebugScopedSetMainThreadBlocked() {} | 148 ~DebugScopedSetMainThreadBlocked() {} |
149 }; | 149 }; |
150 #endif | 150 #endif |
151 | 151 |
152 } | 152 } // namespace cc |
153 | 153 |
154 #endif // CC_TREES_PROXY_H_ | 154 #endif // CC_TREES_PROXY_H_ |
OLD | NEW |