| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 class CC_EXPORT Proxy { | 39 class CC_EXPORT Proxy { |
| 40 public: | 40 public: |
| 41 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; | 41 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; |
| 42 bool HasImplThread() const; | 42 bool HasImplThread() const; |
| 43 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; | 43 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; |
| 44 | 44 |
| 45 // Debug hooks. | 45 // Debug hooks. |
| 46 bool IsMainThread() const; | 46 bool IsMainThread() const; |
| 47 bool IsImplThread() const; | 47 bool IsImplThread() const; |
| 48 bool IsMainThreadBlocked() const; | 48 bool IsMainThreadBlocked() const; |
| 49 #if DCHECK_IS_ON | 49 #if DCHECK_IS_ON() |
| 50 void SetMainThreadBlocked(bool is_main_thread_blocked); | 50 void SetMainThreadBlocked(bool is_main_thread_blocked); |
| 51 void SetCurrentThreadIsImplThread(bool is_impl_thread); | 51 void SetCurrentThreadIsImplThread(bool is_impl_thread); |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 virtual ~Proxy(); | 54 virtual ~Proxy(); |
| 55 | 55 |
| 56 virtual void FinishAllRendering() = 0; | 56 virtual void FinishAllRendering() = 0; |
| 57 | 57 |
| 58 virtual bool IsStarted() const = 0; | 58 virtual bool IsStarted() const = 0; |
| 59 | 59 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 121 friend class DebugScopedSetImplThread; | 121 friend class DebugScopedSetImplThread; |
| 122 friend class DebugScopedSetMainThread; | 122 friend class DebugScopedSetMainThread; |
| 123 friend class DebugScopedSetMainThreadBlocked; | 123 friend class DebugScopedSetMainThreadBlocked; |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 127 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 127 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
| 128 scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_; | 128 scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_; |
| 129 | 129 |
| 130 #if DCHECK_IS_ON | 130 #if DCHECK_IS_ON() |
| 131 const base::PlatformThreadId main_thread_id_; | 131 const base::PlatformThreadId main_thread_id_; |
| 132 bool impl_thread_is_overridden_; | 132 bool impl_thread_is_overridden_; |
| 133 bool is_main_thread_blocked_; | 133 bool is_main_thread_blocked_; |
| 134 #endif | 134 #endif |
| 135 | 135 |
| 136 DISALLOW_COPY_AND_ASSIGN(Proxy); | 136 DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 #if DCHECK_IS_ON | 139 #if DCHECK_IS_ON() |
| 140 class DebugScopedSetMainThreadBlocked { | 140 class DebugScopedSetMainThreadBlocked { |
| 141 public: | 141 public: |
| 142 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) { | 142 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) { |
| 143 DCHECK(!proxy_->IsMainThreadBlocked()); | 143 DCHECK(!proxy_->IsMainThreadBlocked()); |
| 144 proxy_->SetMainThreadBlocked(true); | 144 proxy_->SetMainThreadBlocked(true); |
| 145 } | 145 } |
| 146 ~DebugScopedSetMainThreadBlocked() { | 146 ~DebugScopedSetMainThreadBlocked() { |
| 147 DCHECK(proxy_->IsMainThreadBlocked()); | 147 DCHECK(proxy_->IsMainThreadBlocked()); |
| 148 proxy_->SetMainThreadBlocked(false); | 148 proxy_->SetMainThreadBlocked(false); |
| 149 } | 149 } |
| 150 private: | 150 private: |
| 151 Proxy* proxy_; | 151 Proxy* proxy_; |
| 152 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); | 152 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); |
| 153 }; | 153 }; |
| 154 #else | 154 #else |
| 155 class DebugScopedSetMainThreadBlocked { | 155 class DebugScopedSetMainThreadBlocked { |
| 156 public: | 156 public: |
| 157 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} | 157 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} |
| 158 ~DebugScopedSetMainThreadBlocked() {} | 158 ~DebugScopedSetMainThreadBlocked() {} |
| 159 private: | 159 private: |
| 160 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); | 160 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); |
| 161 }; | 161 }; |
| 162 #endif | 162 #endif |
| 163 | 163 |
| 164 } // namespace cc | 164 } // namespace cc |
| 165 | 165 |
| 166 #endif // CC_TREES_PROXY_H_ | 166 #endif // CC_TREES_PROXY_H_ |
| OLD | NEW |