OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CCThread_h | 5 #ifndef CCThread_h |
6 #define CCThread_h | 6 #define CCThread_h |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
9 #include <wtf/PassOwnPtr.h> | 10 #include <wtf/PassOwnPtr.h> |
10 #include <wtf/Noncopyable.h> | |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 // CCThread provides basic infrastructure for messaging with the compositor in a | 14 // CCThread provides basic infrastructure for messaging with the compositor in a |
15 // platform-neutral way. | 15 // platform-neutral way. |
16 class CCThread { | 16 class CCThread { |
17 public: | 17 public: |
18 virtual ~CCThread() { } | 18 virtual ~CCThread() { } |
19 | 19 |
20 class Task { | 20 class Task { |
21 WTF_MAKE_NONCOPYABLE(Task); | |
22 public: | 21 public: |
23 virtual ~Task() { } | 22 virtual ~Task() { } |
24 virtual void performTask() = 0; | 23 virtual void performTask() = 0; |
25 void* instance() const { return m_instance; } | 24 void* instance() const { return m_instance; } |
26 protected: | 25 protected: |
27 Task(void* instance) : m_instance(instance) { } | 26 Task(void* instance) : m_instance(instance) { } |
28 void* m_instance; | 27 void* m_instance; |
| 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(Task); |
29 }; | 30 }; |
30 | 31 |
31 // Executes the task on context's thread asynchronously. | 32 // Executes the task on context's thread asynchronously. |
32 virtual void postTask(PassOwnPtr<Task>) = 0; | 33 virtual void postTask(PassOwnPtr<Task>) = 0; |
33 | 34 |
34 // Executes the task after the specified delay. | 35 // Executes the task after the specified delay. |
35 virtual void postDelayedTask(PassOwnPtr<Task>, long long delayMs) = 0; | 36 virtual void postDelayedTask(PassOwnPtr<Task>, long long delayMs) = 0; |
36 | 37 |
37 virtual base::PlatformThreadId threadID() const = 0; | 38 virtual base::PlatformThreadId threadID() const = 0; |
38 }; | 39 }; |
39 | 40 |
40 } | 41 } |
41 | 42 |
42 #endif | 43 #endif |
OLD | NEW |