summaryrefslogtreecommitdiffstats
path: root/webkit/compositor_bindings/ccthread_impl.h
blob: 259ca4ab34a1f10f752ca85f038c1dcddbf6af07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/memory/scoped_ptr.h"
#include "base/threading/platform_thread.h"
#include "cc/thread.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>

#ifndef CCThreadImpl_h
#define CCThreadImpl_h

namespace WebKit {

class WebThread;

// Implements Thread in terms of WebThread.
class CCThreadImpl : public cc::Thread {
public:
    // Creates a CCThreadImpl wrapping the current thread.
    static scoped_ptr<cc::Thread> createForCurrentThread();

    // Creates a Thread wrapping a non-current WebThread.
    static scoped_ptr<cc::Thread> createForDifferentThread(WebThread*);

    virtual ~CCThreadImpl();
    virtual void postTask(PassOwnPtr<cc::Thread::Task>);
    virtual void postDelayedTask(PassOwnPtr<cc::Thread::Task>, long long delayMs);
    base::PlatformThreadId threadID() const;

private:
    CCThreadImpl(WebThread*, bool currentThread);

    WebThread* m_thread;
    base::PlatformThreadId m_threadID;
};

} // namespace WebKit

#endif