| OLD | NEW |
| 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 "cc/thread_impl.h" | 5 #include "cc/thread_impl.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 scoped_ptr<Thread> ThreadImpl::createForCurrentThread() | 11 scoped_ptr<Thread> ThreadImpl::createForCurrentThread() |
| 12 { | 12 { |
| 13 return scoped_ptr<Thread>(new ThreadImpl(base::MessageLoopProxy::current()))
.Pass(); | 13 return scoped_ptr<Thread>(new ThreadImpl(base::MessageLoopProxy::current()))
.Pass(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 scoped_ptr<Thread> ThreadImpl::createForDifferentThread(scoped_refptr<base::Mess
ageLoopProxy> thread) | 16 scoped_ptr<Thread> ThreadImpl::createForDifferentThread(scoped_refptr<base::Mess
ageLoopProxy> thread) |
| 17 { | 17 { |
| 18 return scoped_ptr<Thread>(new ThreadImpl(thread)).Pass(); | 18 return scoped_ptr<Thread>(new ThreadImpl(thread)).Pass(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ThreadImpl::~ThreadImpl() | 21 ThreadImpl::~ThreadImpl() |
| 22 { | 22 { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void ThreadImpl::postTask(base::Closure cb) | 25 void ThreadImpl::postTask(base::Closure cb) |
| 26 { | 26 { |
| 27 m_thread->PostTask(FROM_HERE, cb); | 27 m_thread->PostTask(FROM_HERE, cb); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void ThreadImpl::postDelayedTask(base::Closure cb, long long delayMs) | 30 void ThreadImpl::postDelayedTask(base::Closure cb, base::TimeDelta delay) |
| 31 { | 31 { |
| 32 m_thread->PostDelayedTask(FROM_HERE, cb, base::TimeDelta::FromMilliseconds(d
elayMs)); | 32 m_thread->PostDelayedTask(FROM_HERE, cb, delay); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool ThreadImpl::belongsToCurrentThread() const | 35 bool ThreadImpl::belongsToCurrentThread() const |
| 36 { | 36 { |
| 37 return m_thread->BelongsToCurrentThread(); | 37 return m_thread->BelongsToCurrentThread(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 ThreadImpl::ThreadImpl(scoped_refptr<base::MessageLoopProxy> thread) | 40 ThreadImpl::ThreadImpl(scoped_refptr<base::MessageLoopProxy> thread) |
| 41 : m_thread(thread) | 41 : m_thread(thread) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace cc | 45 } // namespace cc |
| OLD | NEW |