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_OFF |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 118 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
119 friend class DebugScopedSetImplThread; | 119 friend class DebugScopedSetImplThread; |
120 friend class DebugScopedSetMainThread; | 120 friend class DebugScopedSetMainThread; |
121 friend class DebugScopedSetMainThreadBlocked; | 121 friend class DebugScopedSetMainThreadBlocked; |
122 | 122 |
123 private: | 123 private: |
124 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 124 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
125 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 125 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
126 scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_; | 126 scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_; |
127 | 127 |
128 #if DCHECK_IS_ON | 128 #if !DCHECK_IS_OFF |
129 const base::PlatformThreadId main_thread_id_; | 129 const base::PlatformThreadId main_thread_id_; |
130 bool impl_thread_is_overridden_; | 130 bool impl_thread_is_overridden_; |
131 bool is_main_thread_blocked_; | 131 bool is_main_thread_blocked_; |
132 #endif | 132 #endif |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(Proxy); | 134 DISALLOW_COPY_AND_ASSIGN(Proxy); |
135 }; | 135 }; |
136 | 136 |
137 #if DCHECK_IS_ON | 137 #if !DCHECK_IS_OFF |
138 class DebugScopedSetMainThreadBlocked { | 138 class DebugScopedSetMainThreadBlocked { |
139 public: | 139 public: |
140 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) { | 140 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) : proxy_(proxy) { |
141 DCHECK(!proxy_->IsMainThreadBlocked()); | 141 DCHECK(!proxy_->IsMainThreadBlocked()); |
142 proxy_->SetMainThreadBlocked(true); | 142 proxy_->SetMainThreadBlocked(true); |
143 } | 143 } |
144 ~DebugScopedSetMainThreadBlocked() { | 144 ~DebugScopedSetMainThreadBlocked() { |
145 DCHECK(proxy_->IsMainThreadBlocked()); | 145 DCHECK(proxy_->IsMainThreadBlocked()); |
146 proxy_->SetMainThreadBlocked(false); | 146 proxy_->SetMainThreadBlocked(false); |
147 } | 147 } |
148 private: | 148 private: |
149 Proxy* proxy_; | 149 Proxy* proxy_; |
150 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); | 150 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); |
151 }; | 151 }; |
152 #else | 152 #else |
153 class DebugScopedSetMainThreadBlocked { | 153 class DebugScopedSetMainThreadBlocked { |
154 public: | 154 public: |
155 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} | 155 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} |
156 ~DebugScopedSetMainThreadBlocked() {} | 156 ~DebugScopedSetMainThreadBlocked() {} |
157 private: | 157 private: |
158 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); | 158 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); |
159 }; | 159 }; |
160 #endif | 160 #endif |
161 | 161 |
162 } // namespace cc | 162 } // namespace cc |
163 | 163 |
164 #endif // CC_TREES_PROXY_H_ | 164 #endif // CC_TREES_PROXY_H_ |
OLD | NEW |