OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/base/thread_impl.h" | |
6 | |
7 #include "base/message_loop.h" | |
8 | |
9 namespace cc { | |
10 | |
11 scoped_ptr<Thread> ThreadImpl::CreateForCurrentThread() { | |
12 return scoped_ptr<Thread>( | |
13 new ThreadImpl(base::MessageLoopProxy::current())).Pass(); | |
14 } | |
15 | |
16 scoped_ptr<Thread> ThreadImpl::CreateForDifferentThread( | |
17 scoped_refptr<base::MessageLoopProxy> thread) { | |
18 return scoped_ptr<Thread>(new ThreadImpl(thread)).Pass(); | |
19 } | |
20 | |
21 ThreadImpl::~ThreadImpl() {} | |
22 | |
23 void ThreadImpl::PostTask(base::Closure cb) { | |
24 thread_->PostTask(FROM_HERE, cb); | |
25 } | |
26 | |
27 void ThreadImpl::PostDelayedTask(base::Closure cb, base::TimeDelta delay) { | |
28 thread_->PostDelayedTask(FROM_HERE, cb, delay); | |
29 } | |
30 | |
31 bool ThreadImpl::BelongsToCurrentThread() const { | |
32 return thread_->BelongsToCurrentThread(); | |
33 } | |
34 | |
35 base::SingleThreadTaskRunner* ThreadImpl::TaskRunner() { | |
36 return thread_.get(); | |
37 } | |
38 | |
39 ThreadImpl::ThreadImpl(scoped_refptr<base::MessageLoopProxy> thread) | |
40 : thread_(thread) {} | |
41 | |
42 } // namespace cc | |
OLD | NEW |