Index: cc/trees/proxy.cc |
diff --git a/cc/trees/proxy.cc b/cc/trees/proxy.cc |
index fd39ed02369febfae2793d2107608d26a075e617..55a58af445ec783f20621827878632a35fd1ad91 100644 |
--- a/cc/trees/proxy.cc |
+++ b/cc/trees/proxy.cc |
@@ -4,31 +4,27 @@ |
#include "cc/trees/proxy.h" |
-#include "cc/base/thread.h" |
-#include "cc/base/thread_impl.h" |
+#include "base/message_loop_proxy.h" |
+#include "base/single_thread_task_runner.h" |
namespace cc { |
-Thread* Proxy::MainThread() const { return main_thread_.get(); } |
- |
-bool Proxy::HasImplThread() const { return impl_thread_; } |
+base::SingleThreadTaskRunner* Proxy::MainThreadTaskRunner() const { |
+ return main_task_runner_.get(); |
+} |
-Thread* Proxy::ImplThread() const { return impl_thread_.get(); } |
+bool Proxy::HasImplThread() const { return !!impl_task_runner_.get(); } |
-Thread* Proxy::CurrentThread() const { |
- if (MainThread() && MainThread()->BelongsToCurrentThread()) |
- return MainThread(); |
- if (ImplThread() && ImplThread()->BelongsToCurrentThread()) |
- return ImplThread(); |
- return NULL; |
+base::SingleThreadTaskRunner* Proxy::ImplThreadTaskRunner() const { |
+ return impl_task_runner_.get(); |
} |
bool Proxy::IsMainThread() const { |
#ifndef NDEBUG |
- DCHECK(MainThread()); |
+ DCHECK(main_task_runner_.get()); |
if (impl_thread_is_overridden_) |
return false; |
- return MainThread()->BelongsToCurrentThread(); |
+ return main_task_runner_->BelongsToCurrentThread(); |
#else |
return true; |
#endif |
@@ -38,7 +34,9 @@ bool Proxy::IsImplThread() const { |
#ifndef NDEBUG |
if (impl_thread_is_overridden_) |
return true; |
- return ImplThread() && ImplThread()->BelongsToCurrentThread(); |
+ if (!impl_task_runner_.get()) |
+ return false; |
+ return impl_task_runner_->BelongsToCurrentThread(); |
#else |
return true; |
#endif |
@@ -64,12 +62,13 @@ void Proxy::SetMainThreadBlocked(bool is_main_thread_blocked) { |
} |
#endif |
-Proxy::Proxy(scoped_ptr<Thread> impl_thread) |
- : main_thread_(ThreadImpl::CreateForCurrentThread()), |
+Proxy::Proxy( |
+ scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
+ : main_task_runner_(base::MessageLoopProxy::current()), |
#ifdef NDEBUG |
- impl_thread_(impl_thread.Pass()) {} |
+ impl_task_runner_(impl_task_runner) {} |
#else |
- impl_thread_(impl_thread.Pass()), |
+ impl_task_runner_(impl_task_runner), |
impl_thread_is_overridden_(false), |
is_main_thread_blocked_(false) {} |
#endif |