summaryrefslogtreecommitdiffstats
path: root/cc/scoped_thread_proxy.cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 23:29:50 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 23:29:50 +0000
commit4a04889139472080d9be371c2c0f618c4da4e7a0 (patch)
tree56aa5d18e5e77b6248bd7293f7b43f2f95c713d0 /cc/scoped_thread_proxy.cc
parentfe9d2edcd0ca528f1489fdb2df7ba5b9563f5f60 (diff)
downloadchromium_src-4a04889139472080d9be371c2c0f618c4da4e7a0.zip
chromium_src-4a04889139472080d9be371c2c0f618c4da4e7a0.tar.gz
chromium_src-4a04889139472080d9be371c2c0f618c4da4e7a0.tar.bz2
Remove WebKit::Platform dependencies from cc
This removes all dependencies on the static WebKit::Platform pointer from cc. The biggest change is implementing cc::Thread on top of base::MessageLoopProxy instead of WebKit::WebThread. For the main thread cc::Thread simply binds to the current thread's MessageLoopProxy. For the impl thread, the bindings layer (specifically webkit/compositor_bindings/web_compositor_impl) extracts the MessageLoopProxy out of the passed in WebThread. BUG=144539 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=165050 Review URL: https://codereview.chromium.org/11344004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/scoped_thread_proxy.cc')
-rw-r--r--cc/scoped_thread_proxy.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/cc/scoped_thread_proxy.cc b/cc/scoped_thread_proxy.cc
index a181270..9391e3b 100644
--- a/cc/scoped_thread_proxy.cc
+++ b/cc/scoped_thread_proxy.cc
@@ -6,9 +6,11 @@
#include "cc/scoped_thread_proxy.h"
+#include "base/bind.h"
+
namespace cc {
-ScopedThreadProxy::ScopedThreadProxy(Thread* targetThread)
+ScopedThreadProxy::ScopedThreadProxy(cc::Thread* targetThread)
: m_targetThread(targetThread)
, m_shutdown(false)
{
@@ -18,4 +20,27 @@ ScopedThreadProxy::~ScopedThreadProxy()
{
}
+void ScopedThreadProxy::postTask(const tracked_objects::Location& location, base::Closure cb)
+{
+ m_targetThread->postTask(base::Bind(&ScopedThreadProxy::runTaskIfNotShutdown, this, cb));
+}
+
+void ScopedThreadProxy::shutdown()
+{
+ DCHECK(m_targetThread->belongsToCurrentThread());
+ DCHECK(!m_shutdown);
+ m_shutdown = true;
+}
+
+void ScopedThreadProxy::runTaskIfNotShutdown(base::Closure cb)
+{
+ // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't
+ // touch it.
+ if (m_shutdown) {
+ return;
+ }
+ DCHECK(m_targetThread->belongsToCurrentThread());
+ cb.Run();
+}
+
}