Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: cc/trees/single_thread_proxy.h

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/proxy.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SINGLE_THREAD_PROXY_H_ 5 #ifndef CC_TREES_SINGLE_THREAD_PROXY_H_
6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_
7 7
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 base::WeakPtrFactory<SingleThreadProxy> weak_factory_; 169 base::WeakPtrFactory<SingleThreadProxy> weak_factory_;
170 170
171 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy); 171 DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy);
172 }; 172 };
173 173
174 // For use in the single-threaded case. In debug builds, it pretends that the 174 // For use in the single-threaded case. In debug builds, it pretends that the
175 // code is running on the impl thread to satisfy assertion checks. 175 // code is running on the impl thread to satisfy assertion checks.
176 class DebugScopedSetImplThread { 176 class DebugScopedSetImplThread {
177 public: 177 public:
178 explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) { 178 explicit DebugScopedSetImplThread(Proxy* proxy) : proxy_(proxy) {
179 #if DCHECK_IS_ON 179 #if DCHECK_IS_ON()
180 previous_value_ = proxy_->impl_thread_is_overridden_; 180 previous_value_ = proxy_->impl_thread_is_overridden_;
181 proxy_->SetCurrentThreadIsImplThread(true); 181 proxy_->SetCurrentThreadIsImplThread(true);
182 #endif 182 #endif
183 } 183 }
184 ~DebugScopedSetImplThread() { 184 ~DebugScopedSetImplThread() {
185 #if DCHECK_IS_ON 185 #if DCHECK_IS_ON()
186 proxy_->SetCurrentThreadIsImplThread(previous_value_); 186 proxy_->SetCurrentThreadIsImplThread(previous_value_);
187 #endif 187 #endif
188 } 188 }
189 189
190 private: 190 private:
191 bool previous_value_; 191 bool previous_value_;
192 Proxy* proxy_; 192 Proxy* proxy_;
193 193
194 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThread); 194 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThread);
195 }; 195 };
196 196
197 // For use in the single-threaded case. In debug builds, it pretends that the 197 // For use in the single-threaded case. In debug builds, it pretends that the
198 // code is running on the main thread to satisfy assertion checks. 198 // code is running on the main thread to satisfy assertion checks.
199 class DebugScopedSetMainThread { 199 class DebugScopedSetMainThread {
200 public: 200 public:
201 explicit DebugScopedSetMainThread(Proxy* proxy) : proxy_(proxy) { 201 explicit DebugScopedSetMainThread(Proxy* proxy) : proxy_(proxy) {
202 #if DCHECK_IS_ON 202 #if DCHECK_IS_ON()
203 previous_value_ = proxy_->impl_thread_is_overridden_; 203 previous_value_ = proxy_->impl_thread_is_overridden_;
204 proxy_->SetCurrentThreadIsImplThread(false); 204 proxy_->SetCurrentThreadIsImplThread(false);
205 #endif 205 #endif
206 } 206 }
207 ~DebugScopedSetMainThread() { 207 ~DebugScopedSetMainThread() {
208 #if DCHECK_IS_ON 208 #if DCHECK_IS_ON()
209 proxy_->SetCurrentThreadIsImplThread(previous_value_); 209 proxy_->SetCurrentThreadIsImplThread(previous_value_);
210 #endif 210 #endif
211 } 211 }
212 212
213 private: 213 private:
214 bool previous_value_; 214 bool previous_value_;
215 Proxy* proxy_; 215 Proxy* proxy_;
216 216
217 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThread); 217 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThread);
218 }; 218 };
219 219
220 // For use in the single-threaded case. In debug builds, it pretends that the 220 // For use in the single-threaded case. In debug builds, it pretends that the
221 // code is running on the impl thread and that the main thread is blocked to 221 // code is running on the impl thread and that the main thread is blocked to
222 // satisfy assertion checks 222 // satisfy assertion checks
223 class DebugScopedSetImplThreadAndMainThreadBlocked { 223 class DebugScopedSetImplThreadAndMainThreadBlocked {
224 public: 224 public:
225 explicit DebugScopedSetImplThreadAndMainThreadBlocked(Proxy* proxy) 225 explicit DebugScopedSetImplThreadAndMainThreadBlocked(Proxy* proxy)
226 : impl_thread_(proxy), main_thread_blocked_(proxy) {} 226 : impl_thread_(proxy), main_thread_blocked_(proxy) {}
227 227
228 private: 228 private:
229 DebugScopedSetImplThread impl_thread_; 229 DebugScopedSetImplThread impl_thread_;
230 DebugScopedSetMainThreadBlocked main_thread_blocked_; 230 DebugScopedSetMainThreadBlocked main_thread_blocked_;
231 231
232 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); 232 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked);
233 }; 233 };
234 234
235 } // namespace cc 235 } // namespace cc
236 236
237 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ 237 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_
OLDNEW
« no previous file with comments | « cc/trees/proxy.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698