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

Unified Diff: cc/scoped_thread_proxy.h

Issue 11344004: Remove WebKit::Platform dependencies from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix webkit_compositor_bindings_unittests Created 8 years, 2 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/resource_update_controller_unittest.cc ('k') | cc/scoped_thread_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
};
« no previous file with comments | « cc/resource_update_controller_unittest.cc ('k') | cc/scoped_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698