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 CC_TREES_PROXY_H_ | 5 #ifndef CC_TREES_PROXY_H_ |
6 #define CC_TREES_PROXY_H_ | 6 #define CC_TREES_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "cc/base/cc_export.h" | 16 #include "cc/base/cc_export.h" |
17 #include "skia/ext/refptr.h" | 17 #include "skia/ext/refptr.h" |
18 #include "third_party/skia/include/core/SkPicture.h" | 18 #include "third_party/skia/include/core/SkPicture.h" |
19 | 19 |
20 namespace base { class SingleThreadTaskRunner; } | 20 namespace base { class SingleThreadTaskRunner; } |
21 | 21 |
22 namespace gfx { | 22 namespace gfx { |
23 class Rect; | 23 class Rect; |
24 class Vector2d; | 24 class Vector2d; |
25 } | 25 } |
26 | 26 |
27 namespace cc { | 27 namespace cc { |
28 | 28 |
| 29 typedef int UIResourceId; |
| 30 class UIResourceBitmap; |
29 class OutputSurface; | 31 class OutputSurface; |
30 struct RendererCapabilities; | 32 struct RendererCapabilities; |
31 | 33 |
32 // Abstract class responsible for proxying commands from the main-thread side of | 34 // Abstract class responsible for proxying commands from the main-thread side of |
33 // the compositor over to the compositor implementation. | 35 // the compositor over to the compositor implementation. |
34 class CC_EXPORT Proxy { | 36 class CC_EXPORT Proxy { |
35 public: | 37 public: |
36 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; | 38 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; |
37 bool HasImplThread() const; | 39 bool HasImplThread() const; |
38 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; | 40 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 95 |
94 virtual void AcquireLayerTextures() = 0; | 96 virtual void AcquireLayerTextures() = 0; |
95 | 97 |
96 virtual skia::RefPtr<SkPicture> CapturePicture() = 0; | 98 virtual skia::RefPtr<SkPicture> CapturePicture() = 0; |
97 virtual scoped_ptr<base::Value> AsValue() const = 0; | 99 virtual scoped_ptr<base::Value> AsValue() const = 0; |
98 | 100 |
99 // Testing hooks | 101 // Testing hooks |
100 virtual bool CommitPendingForTesting() = 0; | 102 virtual bool CommitPendingForTesting() = 0; |
101 virtual std::string SchedulerStateAsStringForTesting(); | 103 virtual std::string SchedulerStateAsStringForTesting(); |
102 | 104 |
| 105 virtual void CreateUIResource(UIResourceId uid, |
| 106 scoped_refptr<UIResourceBitmap> bitmap, |
| 107 bool async) = 0; |
| 108 |
| 109 virtual void |
| 110 CreateUIResourceOnImplThread(UIResourceId uid, |
| 111 scoped_refptr<UIResourceBitmap> bitmap, |
| 112 bool async) = 0; |
| 113 |
| 114 virtual void DeleteUIResource(UIResourceId uid) = 0; |
| 115 |
| 116 virtual void DeleteUIResourceOnImplThread(UIResourceId uid) = 0; |
| 117 |
103 protected: | 118 protected: |
104 explicit Proxy( | 119 explicit Proxy( |
105 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
106 friend class DebugScopedSetImplThread; | 121 friend class DebugScopedSetImplThread; |
107 friend class DebugScopedSetMainThread; | 122 friend class DebugScopedSetMainThread; |
108 friend class DebugScopedSetMainThreadBlocked; | 123 friend class DebugScopedSetMainThreadBlocked; |
109 | 124 |
110 private: | 125 private: |
111 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
112 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 127 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
(...skipping 26 matching lines...) Expand all Loading... |
139 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} | 154 explicit DebugScopedSetMainThreadBlocked(Proxy* proxy) {} |
140 ~DebugScopedSetMainThreadBlocked() {} | 155 ~DebugScopedSetMainThreadBlocked() {} |
141 private: | 156 private: |
142 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); | 157 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetMainThreadBlocked); |
143 }; | 158 }; |
144 #endif | 159 #endif |
145 | 160 |
146 } // namespace cc | 161 } // namespace cc |
147 | 162 |
148 #endif // CC_TREES_PROXY_H_ | 163 #endif // CC_TREES_PROXY_H_ |
OLD | NEW |