| 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 #include "cc/trees/proxy.h" | 5 #include "cc/trees/proxy.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 | 11 |
| 12 base::SingleThreadTaskRunner* Proxy::MainThreadTaskRunner() const { | 12 MainThreadTaskRunner* Proxy::MainThreadTaskRunner() const { |
| 13 return main_task_runner_.get(); | 13 return main_task_runner_.get(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool Proxy::HasImplThread() const { return !!impl_task_runner_.get(); } | 16 bool Proxy::HasImplThread() const { return !!impl_task_runner_.get(); } |
| 17 | 17 |
| 18 base::SingleThreadTaskRunner* Proxy::ImplThreadTaskRunner() const { | 18 base::SingleThreadTaskRunner* Proxy::ImplThreadTaskRunner() const { |
| 19 return impl_task_runner_.get(); | 19 return impl_task_runner_.get(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool Proxy::IsMainThread() const { | 22 bool Proxy::IsMainThread() const { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return true; | 59 return true; |
| 60 #endif | 60 #endif |
| 61 } | 61 } |
| 62 | 62 |
| 63 #if DCHECK_IS_ON | 63 #if DCHECK_IS_ON |
| 64 void Proxy::SetMainThreadBlocked(bool is_main_thread_blocked) { | 64 void Proxy::SetMainThreadBlocked(bool is_main_thread_blocked) { |
| 65 is_main_thread_blocked_ = is_main_thread_blocked; | 65 is_main_thread_blocked_ = is_main_thread_blocked; |
| 66 } | 66 } |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 Proxy::Proxy(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 69 Proxy::Proxy( |
| 70 : main_task_runner_(base::MessageLoopProxy::current()), | 70 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner, |
| 71 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
| 71 #if !DCHECK_IS_ON | 72 #if !DCHECK_IS_ON |
| 73 : main_task_runner_(main_task_runner), |
| 72 impl_task_runner_(impl_task_runner) { | 74 impl_task_runner_(impl_task_runner) { |
| 73 #else | 75 #else |
| 76 : main_task_runner_(main_task_runner), |
| 74 impl_task_runner_(impl_task_runner), | 77 impl_task_runner_(impl_task_runner), |
| 75 main_thread_id_(base::PlatformThread::CurrentId()), | 78 main_thread_id_(base::PlatformThread::CurrentId()), |
| 76 impl_thread_is_overridden_(false), | 79 impl_thread_is_overridden_(false), |
| 77 is_main_thread_blocked_(false) { | 80 is_main_thread_blocked_(false) { |
| 78 #endif | 81 #endif |
| 79 } | 82 } |
| 80 | 83 |
| 81 Proxy::~Proxy() { | 84 Proxy::~Proxy() { |
| 82 DCHECK(IsMainThread()); | 85 DCHECK(IsMainThread()); |
| 83 } | 86 } |
| 84 | 87 |
| 85 scoped_ptr<base::Value> Proxy::SchedulerAsValueForTesting() { | 88 scoped_ptr<base::Value> Proxy::SchedulerAsValueForTesting() { |
| 86 return make_scoped_ptr(base::Value::CreateNullValue()); | 89 return make_scoped_ptr(base::Value::CreateNullValue()); |
| 87 } | 90 } |
| 88 | 91 |
| 89 } // namespace cc | 92 } // namespace cc |
| OLD | NEW |