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.
5 #include "cc/base/thread_impl.h"
7 #include "base/message_loop.h"
11 scoped_ptr
<Thread
> ThreadImpl::CreateForCurrentThread() {
12 return scoped_ptr
<Thread
>(
13 new ThreadImpl(base::MessageLoopProxy::current())).Pass();
16 scoped_ptr
<Thread
> ThreadImpl::CreateForDifferentThread(
17 scoped_refptr
<base::MessageLoopProxy
> thread
) {
18 return scoped_ptr
<Thread
>(new ThreadImpl(thread
)).Pass();
21 ThreadImpl::~ThreadImpl() {}
23 void ThreadImpl::PostTask(base::Closure cb
) {
24 thread_
->PostTask(FROM_HERE
, cb
);
27 void ThreadImpl::PostDelayedTask(base::Closure cb
, base::TimeDelta delay
) {
28 thread_
->PostDelayedTask(FROM_HERE
, cb
, delay
);
31 bool ThreadImpl::BelongsToCurrentThread() const {
32 return thread_
->BelongsToCurrentThread();
35 ThreadImpl::ThreadImpl(scoped_refptr
<base::MessageLoopProxy
> thread
)