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 #ifndef CC_BASE_THREAD_IMPL_H_
6 #define CC_BASE_THREAD_IMPL_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop_proxy.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/base/thread.h"
16 // Implements cc::Thread in terms of base::MessageLoopProxy.
17 class CC_EXPORT ThreadImpl
: public Thread
{
19 // Creates a ThreadImpl wrapping the current thread.
20 static scoped_ptr
<cc::Thread
> CreateForCurrentThread();
22 // Creates a Thread wrapping a non-current thread.
23 static scoped_ptr
<cc::Thread
> CreateForDifferentThread(
24 scoped_refptr
<base::MessageLoopProxy
> thread
);
26 virtual ~ThreadImpl();
28 virtual void PostTask(base::Closure cb
) OVERRIDE
;
29 virtual void PostDelayedTask(base::Closure cb
, base::TimeDelta delay
)
31 virtual bool BelongsToCurrentThread() const OVERRIDE
;
34 explicit ThreadImpl(scoped_refptr
<base::MessageLoopProxy
> thread
);
36 scoped_refptr
<base::MessageLoopProxy
> thread_
;
38 DISALLOW_COPY_AND_ASSIGN(ThreadImpl
);
43 #endif // CC_BASE_THREAD_IMPL_H_