Index: cc/scoped_thread_proxy.h |
diff --git a/cc/scoped_thread_proxy.h b/cc/scoped_thread_proxy.h |
index 023eaba9ff70c62c8e8afb267be38d704656ce96..b48f27623c073b9b21d8b548212d6f67ec908962 100644 |
--- a/cc/scoped_thread_proxy.h |
+++ b/cc/scoped_thread_proxy.h |
@@ -5,12 +5,11 @@ |
#ifndef CCScopedThreadProxy_h |
#define CCScopedThreadProxy_h |
-#include "base/logging.h" |
#include "base/memory/ref_counted.h" |
-#include "base/threading/platform_thread.h" |
-#include "cc/thread_task.h" |
-#include <wtf/OwnPtr.h> |
-#include <wtf/PassOwnPtr.h> |
+#include "base/callback.h" |
+#include "cc/thread.h" |
+#include "base/location.h" |
+#include "base/logging.h" |
namespace cc { |
@@ -26,49 +25,26 @@ namespace cc { |
// list of outstanding tasks. |
class ScopedThreadProxy : public base::RefCountedThreadSafe<ScopedThreadProxy> { |
public: |
- static scoped_refptr<ScopedThreadProxy> create(Thread* targetThread) |
+ static scoped_refptr<ScopedThreadProxy> create(cc::Thread* targetThread) |
{ |
- DCHECK(base::PlatformThread::CurrentId() == targetThread->threadID()); |
+ DCHECK(targetThread->belongsToCurrentThread()); |
return make_scoped_refptr(new ScopedThreadProxy(targetThread)); |
} |
- |
// Can be called from any thread. Posts a task to the target thread that runs unless |
// shutdown() is called before it runs. |
- void postTask(PassOwnPtr<Thread::Task> task) |
- { |
- AddRef(); |
- m_targetThread->postTask(createThreadTask(this, &ScopedThreadProxy::runTaskIfNotShutdown, task)); |
- } |
+ void postTask(const tracked_objects::Location& location, base::Closure cb); |
- void shutdown() |
- { |
- DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID()); |
- DCHECK(!m_shutdown); |
- m_shutdown = true; |
- } |
+ void shutdown(); |
private: |
+ explicit ScopedThreadProxy(cc::Thread* targetThread); |
friend class base::RefCountedThreadSafe<ScopedThreadProxy>; |
~ScopedThreadProxy(); |
- explicit ScopedThreadProxy(Thread* targetThread); |
- |
- void runTaskIfNotShutdown(PassOwnPtr<Thread::Task> popTask) |
- { |
- OwnPtr<Thread::Task> task = popTask; |
- // If our shutdown flag is set, it's possible that m_targetThread has already been destroyed so don't |
- // touch it. |
- if (m_shutdown) { |
- Release(); |
- return; |
- } |
- DCHECK(base::PlatformThread::CurrentId() == m_targetThread->threadID()); |
- task->performTask(); |
- Release(); |
- } |
+ void runTaskIfNotShutdown(base::Closure cb); |
- Thread* m_targetThread; |
+ cc::Thread* m_targetThread; |
bool m_shutdown; // Only accessed on the target thread |
}; |