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/thread_impl.h"
7 #include "base/message_loop.h"
11 scoped_ptr
<Thread
> ThreadImpl::createForCurrentThread()
13 return scoped_ptr
<Thread
>(new ThreadImpl(base::MessageLoopProxy::current())).Pass();
16 scoped_ptr
<Thread
> ThreadImpl::createForDifferentThread(scoped_refptr
<base::MessageLoopProxy
> thread
)
18 return scoped_ptr
<Thread
>(new ThreadImpl(thread
)).Pass();
21 ThreadImpl::~ThreadImpl()
25 void ThreadImpl::postTask(base::Closure cb
)
27 m_thread
->PostTask(FROM_HERE
, cb
);
30 void ThreadImpl::postDelayedTask(base::Closure cb
, long long delayMs
)
32 m_thread
->PostDelayedTask(FROM_HERE
, cb
, base::TimeDelta::FromMilliseconds(delayMs
));
35 bool ThreadImpl::belongsToCurrentThread() const
37 return m_thread
->BelongsToCurrentThread();
40 ThreadImpl::ThreadImpl(scoped_refptr
<base::MessageLoopProxy
> thread
)