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

Side by Side Diff: webkit/compositor_bindings/CCThreadImpl.cpp

Issue 11142031: Remove WTF dependencies from webkit_compositor_bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "CCThreadImpl.h" 6 #include "CCThreadImpl.h"
7 7
8 #include "CCCompletionEvent.h" 8 #include "cc/completion_event.h"
9 #include <public/Platform.h> 9 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
10 #include <public/WebThread.h> 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebThread.h"
11 11
12 using cc::CCThread; 12 using cc::CCThread;
13 using cc::CCCompletionEvent; 13 using cc::CCCompletionEvent;
14 14
15 namespace WebKit { 15 namespace WebKit {
16 16
17 // Task that, when runs, places the current thread ID into the provided 17 // Task that, when runs, places the current thread ID into the provided
18 // pointer and signals a completion event. 18 // pointer and signals a completion event.
19 // 19 //
20 // Does not provide a PassOwnPtr<GetThreadIDTask>::create method because 20 // Does not provide a PassOwnPtr<GetThreadIDTask>::create method because
(...skipping 14 matching lines...) Expand all
35 } 35 }
36 36
37 private: 37 private:
38 CCCompletionEvent* m_completion; 38 CCCompletionEvent* m_completion;
39 base::PlatformThreadId* m_result; 39 base::PlatformThreadId* m_result;
40 }; 40 };
41 41
42 // General adapter from a CCThread::Task to a WebThread::Task. 42 // General adapter from a CCThread::Task to a WebThread::Task.
43 class CCThreadTaskAdapter : public WebThread::Task { 43 class CCThreadTaskAdapter : public WebThread::Task {
44 public: 44 public:
45 CCThreadTaskAdapter(PassOwnPtr<CCThread::Task> task) : m_task(task) { } 45 explicit CCThreadTaskAdapter(PassOwnPtr<CCThread::Task> task) : m_task(task) { }
46 46
47 virtual ~CCThreadTaskAdapter() { } 47 virtual ~CCThreadTaskAdapter() { }
48 48
49 virtual void run() 49 virtual void run()
50 { 50 {
51 m_task->performTask(); 51 m_task->performTask();
52 } 52 }
53 53
54 private: 54 private:
55 OwnPtr<CCThread::Task> m_task; 55 OwnPtr<CCThread::Task> m_task;
56 }; 56 };
57 57
58 PassOwnPtr<CCThread> CCThreadImpl::createForCurrentThread() 58 scoped_ptr<CCThread> CCThreadImpl::createForCurrentThread()
59 { 59 {
60 return adoptPtr(new CCThreadImpl(Platform::current()->currentThread(), true) ); 60 return scoped_ptr<CCThread>(new CCThreadImpl(Platform::current()->currentThr ead(), true)).Pass();
61 } 61 }
62 62
63 PassOwnPtr<CCThread> CCThreadImpl::createForDifferentThread(WebThread* thread) 63 scoped_ptr<CCThread> CCThreadImpl::createForDifferentThread(WebThread* thread)
64 { 64 {
65 return adoptPtr(new CCThreadImpl(thread, false)); 65 return scoped_ptr<CCThread>(new CCThreadImpl(thread, false)).Pass();
66 } 66 }
67 67
68 CCThreadImpl::~CCThreadImpl() 68 CCThreadImpl::~CCThreadImpl()
69 { 69 {
70 } 70 }
71 71
72 void CCThreadImpl::postTask(PassOwnPtr<CCThread::Task> task) 72 void CCThreadImpl::postTask(PassOwnPtr<CCThread::Task> task)
73 { 73 {
74 m_thread->postTask(new CCThreadTaskAdapter(task)); 74 m_thread->postTask(new CCThreadTaskAdapter(task));
75 } 75 }
(...skipping 17 matching lines...) Expand all
93 } 93 }
94 94
95 // Get the threadId for the newly-created thread by running a task 95 // Get the threadId for the newly-created thread by running a task
96 // on that thread, blocking on the result. 96 // on that thread, blocking on the result.
97 CCCompletionEvent completion; 97 CCCompletionEvent completion;
98 m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion)); 98 m_thread->postTask(new GetThreadIDTask(&m_threadID, &completion));
99 completion.wait(); 99 completion.wait();
100 } 100 }
101 101
102 } // namespace WebKit 102 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/CCThreadImpl.h ('k') | webkit/compositor_bindings/WebAnimationCurveCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698