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

Unified Diff: cc/trees/proxy.cc

Issue 17114008: cc: Remove cc::Thread and cc::ThreadImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm-thread: NULLrefptrs Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/proxy.h ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/trees/proxy.h ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698