OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "webkit/compositor_bindings/web_compositor_support_impl.h" | 5 #include "webkit/compositor_bindings/web_compositor_support_impl.h" |
6 | 6 |
7 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
8 #include "config.h" | 7 #include "config.h" |
9 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
10 #include "webkit/compositor_bindings/WebLayerImpl.h" | 9 #include "webkit/compositor_bindings/WebLayerImpl.h" |
11 #include "webkit/compositor_bindings/WebLayerTreeViewImpl.h" | 10 #include "webkit/compositor_bindings/WebLayerTreeViewImpl.h" |
12 #include "webkit/compositor_bindings/WebCompositorImpl.h" | 11 #include "webkit/compositor_bindings/WebCompositorImpl.h" |
13 #include "webkit/compositor_bindings/WebContentLayerImpl.h" | 12 #include "webkit/compositor_bindings/WebContentLayerImpl.h" |
14 #include "webkit/compositor_bindings/WebDelegatedRendererLayerImpl.h" | 13 #include "webkit/compositor_bindings/WebDelegatedRendererLayerImpl.h" |
15 #include "webkit/compositor_bindings/WebExternalTextureLayerImpl.h" | 14 #include "webkit/compositor_bindings/WebExternalTextureLayerImpl.h" |
16 #include "webkit/compositor_bindings/WebIOSurfaceLayerImpl.h" | 15 #include "webkit/compositor_bindings/WebIOSurfaceLayerImpl.h" |
17 #include "webkit/compositor_bindings/WebSolidColorLayerImpl.h" | 16 #include "webkit/compositor_bindings/WebSolidColorLayerImpl.h" |
18 #include "webkit/compositor_bindings/WebImageLayerImpl.h" | 17 #include "webkit/compositor_bindings/WebImageLayerImpl.h" |
19 #include "webkit/compositor_bindings/WebVideoLayerImpl.h" | 18 #include "webkit/compositor_bindings/WebVideoLayerImpl.h" |
20 #include "webkit/compositor_bindings/WebScrollbarLayerImpl.h" | 19 #include "webkit/compositor_bindings/WebScrollbarLayerImpl.h" |
21 #include "webkit/compositor_bindings/WebAnimationImpl.h" | 20 #include "webkit/compositor_bindings/WebAnimationImpl.h" |
22 #include "webkit/compositor_bindings/WebFloatAnimationCurveImpl.h" | 21 #include "webkit/compositor_bindings/WebFloatAnimationCurveImpl.h" |
23 #include "webkit/compositor_bindings/WebTransformAnimationCurveImpl.h" | 22 #include "webkit/compositor_bindings/WebTransformAnimationCurveImpl.h" |
24 #else | |
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h" | |
26 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositor.h" | |
27 #include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" | |
28 #include "third_party/WebKit/Source/Platform/chromium/public/WebExternalTextureL
ayer.h" | |
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatAnimationCu
rve.h" | |
30 #include "third_party/WebKit/Source/Platform/chromium/public/WebIOSurfaceLayer.h
" | |
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebImageLayer.h" | |
32 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | |
33 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarLayer.h
" | |
34 #include "third_party/WebKit/Source/Platform/chromium/public/WebSolidColorLayer.
h" | |
35 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformAnimati
onCurve.h" | |
36 #include "third_party/WebKit/Source/Platform/chromium/public/WebVideoLayer.h" | |
37 #endif | |
38 | 23 |
39 using WebKit::WebAnimation; | 24 using WebKit::WebAnimation; |
40 using WebKit::WebAnimationCurve; | 25 using WebKit::WebAnimationCurve; |
41 using WebKit::WebContentLayer; | 26 using WebKit::WebContentLayer; |
42 using WebKit::WebContentLayerClient; | 27 using WebKit::WebContentLayerClient; |
43 using WebKit::WebDelegatedRendererLayer; | 28 using WebKit::WebDelegatedRendererLayer; |
44 using WebKit::WebExternalTextureLayer; | 29 using WebKit::WebExternalTextureLayer; |
45 using WebKit::WebExternalTextureLayerClient; | 30 using WebKit::WebExternalTextureLayerClient; |
46 using WebKit::WebFloatAnimationCurve; | 31 using WebKit::WebFloatAnimationCurve; |
47 using WebKit::WebIOSurfaceLayer; | 32 using WebKit::WebIOSurfaceLayer; |
48 using WebKit::WebImageLayer; | 33 using WebKit::WebImageLayer; |
49 using WebKit::WebImageLayer; | 34 using WebKit::WebImageLayer; |
50 using WebKit::WebLayer; | 35 using WebKit::WebLayer; |
51 using WebKit::WebLayerTreeView; | 36 using WebKit::WebLayerTreeView; |
52 using WebKit::WebLayerTreeViewClient; | 37 using WebKit::WebLayerTreeViewClient; |
53 using WebKit::WebScrollbar; | 38 using WebKit::WebScrollbar; |
54 using WebKit::WebScrollbarLayer; | 39 using WebKit::WebScrollbarLayer; |
55 using WebKit::WebScrollbarThemeGeometry; | 40 using WebKit::WebScrollbarThemeGeometry; |
56 using WebKit::WebScrollbarThemePainter; | 41 using WebKit::WebScrollbarThemePainter; |
57 using WebKit::WebSolidColorLayer; | 42 using WebKit::WebSolidColorLayer; |
58 using WebKit::WebTransformAnimationCurve; | 43 using WebKit::WebTransformAnimationCurve; |
59 using WebKit::WebVideoFrameProvider; | 44 using WebKit::WebVideoFrameProvider; |
60 using WebKit::WebVideoLayer; | 45 using WebKit::WebVideoLayer; |
61 | 46 |
62 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
63 using WebKit::WebCompositorImpl; | 47 using WebKit::WebCompositorImpl; |
64 #else | |
65 using WebKit::WebCompositor; | |
66 #endif | |
67 | 48 |
68 namespace webkit { | 49 namespace webkit { |
69 | 50 |
70 WebCompositorSupportImpl::WebCompositorSupportImpl() { | 51 WebCompositorSupportImpl::WebCompositorSupportImpl() { |
71 } | 52 } |
72 | 53 |
73 WebCompositorSupportImpl::~WebCompositorSupportImpl() { | 54 WebCompositorSupportImpl::~WebCompositorSupportImpl() { |
74 } | 55 } |
75 | 56 |
76 void WebCompositorSupportImpl::initialize(WebKit::WebThread* thread) { | 57 void WebCompositorSupportImpl::initialize(WebKit::WebThread* thread) { |
77 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
78 WebCompositorImpl::initialize(thread); | 58 WebCompositorImpl::initialize(thread); |
79 #else | |
80 WebCompositor::initialize(thread); | |
81 #endif | |
82 } | 59 } |
83 | 60 |
84 bool WebCompositorSupportImpl::isThreadingEnabled() { | 61 bool WebCompositorSupportImpl::isThreadingEnabled() { |
85 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
86 return WebCompositorImpl::isThreadingEnabled(); | 62 return WebCompositorImpl::isThreadingEnabled(); |
87 #else | |
88 return WebCompositor::isThreadingEnabled(); | |
89 #endif | |
90 } | 63 } |
91 | 64 |
92 void WebCompositorSupportImpl::shutdown() { | 65 void WebCompositorSupportImpl::shutdown() { |
93 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
94 WebCompositorImpl::shutdown(); | 66 WebCompositorImpl::shutdown(); |
95 #else | |
96 WebCompositor::shutdown(); | |
97 #endif | |
98 } | 67 } |
99 | 68 |
100 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { | 69 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { |
101 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
102 WebCompositorImpl::setPerTilePaintingEnabled(enabled); | 70 WebCompositorImpl::setPerTilePaintingEnabled(enabled); |
103 #else | |
104 WebCompositor::setPerTilePaintingEnabled(enabled); | |
105 #endif | |
106 } | 71 } |
107 | 72 |
108 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { | 73 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { |
109 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
110 WebCompositorImpl::setPartialSwapEnabled(enabled); | 74 WebCompositorImpl::setPartialSwapEnabled(enabled); |
111 #else | |
112 WebCompositor::setPartialSwapEnabled(enabled); | |
113 #endif | |
114 } | 75 } |
115 | 76 |
116 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { | 77 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { |
117 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
118 WebCompositorImpl::setAcceleratedAnimationEnabled(enabled); | 78 WebCompositorImpl::setAcceleratedAnimationEnabled(enabled); |
119 #else | |
120 WebCompositor::setAcceleratedAnimationEnabled(enabled); | |
121 #endif | |
122 } | 79 } |
123 | 80 |
124 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { | 81 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { |
125 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
126 WebCompositorImpl::setPageScalePinchZoomEnabled(enabled); | 82 WebCompositorImpl::setPageScalePinchZoomEnabled(enabled); |
127 #else | |
128 WebCompositor::setPageScalePinchZoomEnabled(enabled); | |
129 #endif | |
130 } | 83 } |
131 | 84 |
132 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( | 85 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( |
133 WebLayerTreeViewClient* client, const WebLayer& root, | 86 WebLayerTreeViewClient* client, const WebLayer& root, |
134 const WebLayerTreeView::Settings& settings) { | 87 const WebLayerTreeView::Settings& settings) { |
135 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
136 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( | 88 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( |
137 new WebKit::WebLayerTreeViewImpl(client)); | 89 new WebKit::WebLayerTreeViewImpl(client)); |
138 if (!layerTreeViewImpl->initialize(settings)) | 90 if (!layerTreeViewImpl->initialize(settings)) |
139 return NULL; | 91 return NULL; |
140 layerTreeViewImpl->setRootLayer(root); | 92 layerTreeViewImpl->setRootLayer(root); |
141 return layerTreeViewImpl.release(); | 93 return layerTreeViewImpl.release(); |
142 #else | |
143 return WebLayerTreeView::create(client, root, settings); | |
144 #endif | |
145 } | 94 } |
146 | 95 |
147 WebLayer* WebCompositorSupportImpl::createLayer() { | 96 WebLayer* WebCompositorSupportImpl::createLayer() { |
148 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
149 return new WebKit::WebLayerImpl(); | 97 return new WebKit::WebLayerImpl(); |
150 #else | |
151 return WebLayer::create(); | |
152 #endif | |
153 } | 98 } |
154 | 99 |
155 WebContentLayer* WebCompositorSupportImpl::createContentLayer( | 100 WebContentLayer* WebCompositorSupportImpl::createContentLayer( |
156 WebContentLayerClient* client) { | 101 WebContentLayerClient* client) { |
157 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
158 return new WebKit::WebContentLayerImpl(client); | 102 return new WebKit::WebContentLayerImpl(client); |
159 #else | |
160 return WebKit::WebContentLayer::create(client); | |
161 #endif | |
162 } | 103 } |
163 | 104 |
164 WebDelegatedRendererLayer* | 105 WebDelegatedRendererLayer* |
165 WebCompositorSupportImpl::createDelegatedRendererLayer() { | 106 WebCompositorSupportImpl::createDelegatedRendererLayer() { |
166 return new WebKit::WebDelegatedRendererLayerImpl(); | 107 return new WebKit::WebDelegatedRendererLayerImpl(); |
167 } | 108 } |
168 | 109 |
169 WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer( | 110 WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer( |
170 WebExternalTextureLayerClient* client) { | 111 WebExternalTextureLayerClient* client) { |
171 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
172 return new WebKit::WebExternalTextureLayerImpl(client); | 112 return new WebKit::WebExternalTextureLayerImpl(client); |
173 #else | |
174 return WebKit::WebExternalTextureLayer::create(client); | |
175 #endif | |
176 } | 113 } |
177 | 114 |
178 WebKit::WebIOSurfaceLayer* | 115 WebKit::WebIOSurfaceLayer* |
179 WebCompositorSupportImpl::createIOSurfaceLayer() { | 116 WebCompositorSupportImpl::createIOSurfaceLayer() { |
180 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
181 return new WebKit::WebIOSurfaceLayerImpl(); | 117 return new WebKit::WebIOSurfaceLayerImpl(); |
182 #else | |
183 return WebKit::WebIOSurfaceLayer::create(); | |
184 #endif | |
185 } | 118 } |
186 | 119 |
187 WebKit::WebImageLayer* WebCompositorSupportImpl::createImageLayer() { | 120 WebKit::WebImageLayer* WebCompositorSupportImpl::createImageLayer() { |
188 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
189 return new WebKit::WebImageLayerImpl(); | 121 return new WebKit::WebImageLayerImpl(); |
190 #else | |
191 return WebKit::WebImageLayer::create(); | |
192 #endif | |
193 } | 122 } |
194 | 123 |
195 WebSolidColorLayer* WebCompositorSupportImpl::createSolidColorLayer() { | 124 WebSolidColorLayer* WebCompositorSupportImpl::createSolidColorLayer() { |
196 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
197 return new WebKit::WebSolidColorLayerImpl(); | 125 return new WebKit::WebSolidColorLayerImpl(); |
198 #else | |
199 return WebKit::WebSolidColorLayer::create(); | |
200 #endif | |
201 } | 126 } |
202 | 127 |
203 WebVideoLayer* WebCompositorSupportImpl::createVideoLayer( | 128 WebVideoLayer* WebCompositorSupportImpl::createVideoLayer( |
204 WebKit::WebVideoFrameProvider* provider) { | 129 WebKit::WebVideoFrameProvider* provider) { |
205 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
206 return new WebKit::WebVideoLayerImpl(provider); | 130 return new WebKit::WebVideoLayerImpl(provider); |
207 #else | |
208 return WebKit::WebVideoLayer::create(provider); | |
209 #endif | |
210 } | 131 } |
211 | 132 |
212 WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer( | 133 WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer( |
213 WebScrollbar* scrollbar, | 134 WebScrollbar* scrollbar, |
214 WebScrollbarThemePainter painter, | 135 WebScrollbarThemePainter painter, |
215 WebScrollbarThemeGeometry* geometry) { | 136 WebScrollbarThemeGeometry* geometry) { |
216 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
217 return new WebKit::WebScrollbarLayerImpl(scrollbar, painter, geometry); | 137 return new WebKit::WebScrollbarLayerImpl(scrollbar, painter, geometry); |
218 #else | |
219 return WebKit::WebScrollbarLayer::create(scrollbar, painter, geometry); | |
220 #endif | |
221 } | 138 } |
222 | 139 |
223 WebAnimation* WebCompositorSupportImpl::createAnimation( | 140 WebAnimation* WebCompositorSupportImpl::createAnimation( |
224 const WebKit::WebAnimationCurve& curve, | 141 const WebKit::WebAnimationCurve& curve, |
225 WebKit::WebAnimation::TargetProperty target, | 142 WebKit::WebAnimation::TargetProperty target, |
226 int animationId) { | 143 int animationId) { |
227 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
228 return new WebKit::WebAnimationImpl(curve, target, animationId); | 144 return new WebKit::WebAnimationImpl(curve, target, animationId); |
229 #else | |
230 return WebKit::WebAnimation::create(curve, target, animationId); | |
231 #endif | |
232 } | 145 } |
233 | 146 |
234 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { | 147 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { |
235 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
236 return new WebKit::WebFloatAnimationCurveImpl(); | 148 return new WebKit::WebFloatAnimationCurveImpl(); |
237 #else | |
238 return WebKit::WebFloatAnimationCurve::create(); | |
239 #endif | |
240 } | 149 } |
241 | 150 |
242 WebTransformAnimationCurve* | 151 WebTransformAnimationCurve* |
243 WebCompositorSupportImpl::createTransformAnimationCurve() { | 152 WebCompositorSupportImpl::createTransformAnimationCurve() { |
244 #if defined(USE_LIBCC_FOR_COMPOSITOR) | |
245 return new WebKit::WebTransformAnimationCurveImpl(); | 153 return new WebKit::WebTransformAnimationCurveImpl(); |
246 #else | |
247 return WebKit::WebTransformAnimationCurve::create(); | |
248 #endif | |
249 } | 154 } |
250 | 155 |
251 } // namespace webkit | 156 } // namespace webkit |
OLD | NEW |