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

Unified Diff: webkit/compositor_bindings/CCThreadImpl.cpp

Issue 10913158: Avoid using WTF threading code in cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | « webkit/compositor_bindings/CCThreadImpl.h ('k') | webkit/compositor_bindings/WebCompositorImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/compositor_bindings/CCThreadImpl.cpp
diff --git a/webkit/compositor_bindings/CCThreadImpl.cpp b/webkit/compositor_bindings/CCThreadImpl.cpp
index 18db0ad00bd599eb48314c155564ce9a56be747d..6a58525d0146cca6c58c2dcd8592a0da9262d841 100644
--- a/webkit/compositor_bindings/CCThreadImpl.cpp
+++ b/webkit/compositor_bindings/CCThreadImpl.cpp
@@ -22,7 +22,7 @@ namespace WebKit {
// PassOwnPtrs.
class GetThreadIDTask : public WebThread::Task {
public:
- GetThreadIDTask(ThreadIdentifier* result, CCCompletionEvent* completion)
+ GetThreadIDTask(base::PlatformThreadId* result, CCCompletionEvent* completion)
: m_completion(completion)
, m_result(result) { }
@@ -30,13 +30,13 @@ public:
virtual void run()
{
- *m_result = currentThread();
+ *m_result = base::PlatformThread::CurrentId();
m_completion->signal();
}
private:
CCCompletionEvent* m_completion;
- ThreadIdentifier* m_result;
+ base::PlatformThreadId* m_result;
};
// General adapter from a CCThread::Task to a WebThread::Task.
@@ -55,9 +55,14 @@ private:
OwnPtr<CCThread::Task> m_task;
};
-PassOwnPtr<CCThread> CCThreadImpl::create(WebThread* thread)
+PassOwnPtr<CCThread> CCThreadImpl::createForCurrentThread()
{
- return adoptPtr(new CCThreadImpl(thread));
+ return adoptPtr(new CCThreadImpl(Platform::current()->currentThread(), true));
+}
+
+PassOwnPtr<CCThread> CCThreadImpl::createForDifferentThread(WebThread* thread)
+{
+ return adoptPtr(new CCThreadImpl(thread, false));
}
CCThreadImpl::~CCThreadImpl()
@@ -74,22 +79,21 @@ void CCThreadImpl::postDelayedTask(PassOwnPtr<CCThread::Task> task, long long de
m_thread->postDelayedTask(new CCThreadTaskAdapter(task), delayMs);
}
-ThreadIdentifier CCThreadImpl::threadID() const
+base::PlatformThreadId CCThreadImpl::threadID() const
{
return m_threadID;
}
-CCThreadImpl::CCThreadImpl(WebThread* thread)
+CCThreadImpl::CCThreadImpl(WebThread* thread, bool currentThread)
: m_thread(thread)
{
- if (thread == WebKit::Platform::current()->currentThread()) {
- m_threadID = currentThread();
+ if (currentThread) {
+ m_threadID = base::PlatformThread::CurrentId();
return;
}
// Get the threadId for the newly-created thread by running a task
// on that thread, blocking on the result.
- m_threadID = currentThread();
CCCompletionEvent completion;
m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion));
completion.wait();
« no previous file with comments | « webkit/compositor_bindings/CCThreadImpl.h ('k') | webkit/compositor_bindings/WebCompositorImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698