| 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/base/thread_impl.h" | 5 #include "cc/base/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 return scoped_ptr<Thread>( | 12 return scoped_ptr<Thread>( |
| 13 new ThreadImpl(base::MessageLoopProxy::current())).Pass(); | 13 new ThreadImpl(base::MessageLoopProxy::current())).Pass(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 scoped_ptr<Thread> ThreadImpl::CreateForDifferentThread( | 16 scoped_ptr<Thread> ThreadImpl::CreateForDifferentThread( |
| 17 scoped_refptr<base::MessageLoopProxy> thread) { | 17 scoped_refptr<base::MessageLoopProxy> thread) { |
| 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 void ThreadImpl::PostTask(base::Closure cb) { | 23 void ThreadImpl::PostTask(base::Closure cb) { |
| 24 thread_->PostTask(FROM_HERE, cb); | 24 thread_->PostTask(FROM_HERE, cb); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void ThreadImpl::PostDelayedTask(base::Closure cb, long long delay_ms) { | 27 void ThreadImpl::PostDelayedTask(base::Closure cb, base::TimeDelta delay) { |
| 28 thread_->PostDelayedTask( | 28 thread_->PostDelayedTask(FROM_HERE, cb, delay); |
| 29 FROM_HERE, cb, base::TimeDelta::FromMilliseconds(delay_ms)); | |
| 30 } | 29 } |
| 31 | 30 |
| 32 bool ThreadImpl::BelongsToCurrentThread() const { | 31 bool ThreadImpl::BelongsToCurrentThread() const { |
| 33 return thread_->BelongsToCurrentThread(); | 32 return thread_->BelongsToCurrentThread(); |
| 34 } | 33 } |
| 35 | 34 |
| 36 ThreadImpl::ThreadImpl(scoped_refptr<base::MessageLoopProxy> thread) | 35 ThreadImpl::ThreadImpl(scoped_refptr<base::MessageLoopProxy> thread) |
| 37 : thread_(thread) {} | 36 : thread_(thread) {} |
| 38 | 37 |
| 39 } // namespace cc | 38 } // namespace cc |
| OLD | NEW |