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 "config.h" | 5 #include "config.h" |
6 #include "webkit/compositor_bindings/web_compositor_support_impl.h" | 6 #include "webkit/compositor_bindings/web_compositor_support_impl.h" |
7 | 7 |
| 8 #include "base/message_loop_proxy.h" |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "cc/settings.h" | 10 #include "cc/settings.h" |
| 11 #include "cc/thread_impl.h" |
10 #include "webkit/compositor_bindings/web_animation_impl.h" | 12 #include "webkit/compositor_bindings/web_animation_impl.h" |
11 #include "webkit/compositor_bindings/web_compositor_impl.h" | |
12 #include "webkit/compositor_bindings/web_content_layer_impl.h" | 13 #include "webkit/compositor_bindings/web_content_layer_impl.h" |
13 #include "webkit/compositor_bindings/web_delegated_renderer_layer_impl.h" | 14 #include "webkit/compositor_bindings/web_delegated_renderer_layer_impl.h" |
14 #include "webkit/compositor_bindings/web_external_texture_layer_impl.h" | 15 #include "webkit/compositor_bindings/web_external_texture_layer_impl.h" |
15 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" | 16 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" |
16 #include "webkit/compositor_bindings/web_image_layer_impl.h" | 17 #include "webkit/compositor_bindings/web_image_layer_impl.h" |
17 #include "webkit/compositor_bindings/web_io_surface_layer_impl.h" | 18 #include "webkit/compositor_bindings/web_io_surface_layer_impl.h" |
18 #include "webkit/compositor_bindings/web_layer_impl.h" | 19 #include "webkit/compositor_bindings/web_layer_impl.h" |
19 #include "webkit/compositor_bindings/web_layer_tree_view_impl.h" | 20 #include "webkit/compositor_bindings/web_layer_tree_view_impl.h" |
20 #include "webkit/compositor_bindings/web_scrollbar_layer_impl.h" | 21 #include "webkit/compositor_bindings/web_scrollbar_layer_impl.h" |
21 #include "webkit/compositor_bindings/web_solid_color_layer_impl.h" | 22 #include "webkit/compositor_bindings/web_solid_color_layer_impl.h" |
22 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h" | 23 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h" |
23 #include "webkit/compositor_bindings/web_video_layer_impl.h" | 24 #include "webkit/compositor_bindings/web_video_layer_impl.h" |
| 25 #include "webkit/glue/webthread_impl.h" |
24 | 26 |
25 using WebKit::WebAnimation; | 27 using WebKit::WebAnimation; |
26 using WebKit::WebAnimationCurve; | 28 using WebKit::WebAnimationCurve; |
27 using WebKit::WebContentLayer; | 29 using WebKit::WebContentLayer; |
28 using WebKit::WebContentLayerClient; | 30 using WebKit::WebContentLayerClient; |
29 using WebKit::WebDelegatedRendererLayer; | 31 using WebKit::WebDelegatedRendererLayer; |
30 using WebKit::WebExternalTextureLayer; | 32 using WebKit::WebExternalTextureLayer; |
31 using WebKit::WebExternalTextureLayerClient; | 33 using WebKit::WebExternalTextureLayerClient; |
32 using WebKit::WebFloatAnimationCurve; | 34 using WebKit::WebFloatAnimationCurve; |
33 using WebKit::WebIOSurfaceLayer; | 35 using WebKit::WebIOSurfaceLayer; |
34 using WebKit::WebImageLayer; | 36 using WebKit::WebImageLayer; |
35 using WebKit::WebImageLayer; | 37 using WebKit::WebImageLayer; |
36 using WebKit::WebLayer; | 38 using WebKit::WebLayer; |
37 using WebKit::WebLayerTreeView; | 39 using WebKit::WebLayerTreeView; |
38 using WebKit::WebLayerTreeViewClient; | 40 using WebKit::WebLayerTreeViewClient; |
39 using WebKit::WebScrollbar; | 41 using WebKit::WebScrollbar; |
40 using WebKit::WebScrollbarLayer; | 42 using WebKit::WebScrollbarLayer; |
41 using WebKit::WebScrollbarThemeGeometry; | 43 using WebKit::WebScrollbarThemeGeometry; |
42 using WebKit::WebScrollbarThemePainter; | 44 using WebKit::WebScrollbarThemePainter; |
43 using WebKit::WebSolidColorLayer; | 45 using WebKit::WebSolidColorLayer; |
44 using WebKit::WebTransformAnimationCurve; | 46 using WebKit::WebTransformAnimationCurve; |
45 using WebKit::WebVideoFrameProvider; | 47 using WebKit::WebVideoFrameProvider; |
46 using WebKit::WebVideoLayer; | 48 using WebKit::WebVideoLayer; |
47 | 49 |
48 using WebKit::WebCompositorImpl; | |
49 | |
50 namespace webkit { | 50 namespace webkit { |
51 | 51 |
52 WebCompositorSupportImpl::WebCompositorSupportImpl() { | 52 WebCompositorSupportImpl::WebCompositorSupportImpl() { |
53 } | 53 } |
54 | 54 |
55 WebCompositorSupportImpl::~WebCompositorSupportImpl() { | 55 WebCompositorSupportImpl::~WebCompositorSupportImpl() { |
56 } | 56 } |
57 | 57 |
58 void WebCompositorSupportImpl::initialize(WebKit::WebThread* thread) { | 58 void WebCompositorSupportImpl::initialize(WebKit::WebThread* impl_thread) { |
59 WebCompositorImpl::initialize(thread); | 59 if (impl_thread) |
| 60 impl_thread_message_loop_proxy_ = |
| 61 static_cast<webkit_glue::WebThreadImpl*>(impl_thread)-> |
| 62 message_loop()->message_loop_proxy(); |
60 } | 63 } |
61 | 64 |
62 bool WebCompositorSupportImpl::isThreadingEnabled() { | 65 bool WebCompositorSupportImpl::isThreadingEnabled() { |
63 return WebCompositorImpl::isThreadingEnabled(); | 66 return impl_thread_message_loop_proxy_; |
64 } | 67 } |
65 | 68 |
66 void WebCompositorSupportImpl::shutdown() { | 69 void WebCompositorSupportImpl::shutdown() { |
67 WebCompositorImpl::shutdown(); | |
68 } | 70 } |
69 | 71 |
70 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { | 72 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { |
71 cc::Settings::setPerTilePaintingEnabled(enabled); | 73 cc::Settings::setPerTilePaintingEnabled(enabled); |
72 } | 74 } |
73 | 75 |
74 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { | 76 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { |
75 cc::Settings::setPartialSwapEnabled(enabled); | 77 cc::Settings::setPartialSwapEnabled(enabled); |
76 } | 78 } |
77 | 79 |
78 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { | 80 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { |
79 cc::Settings::setAcceleratedAnimationEnabled(enabled); | 81 cc::Settings::setAcceleratedAnimationEnabled(enabled); |
80 } | 82 } |
81 | 83 |
82 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { | 84 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { |
83 cc::Settings::setPageScalePinchZoomEnabled(enabled); | 85 cc::Settings::setPageScalePinchZoomEnabled(enabled); |
84 } | 86 } |
85 | 87 |
86 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( | 88 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( |
87 WebLayerTreeViewClient* client, const WebLayer& root, | 89 WebLayerTreeViewClient* client, const WebLayer& root, |
88 const WebLayerTreeView::Settings& settings) { | 90 const WebLayerTreeView::Settings& settings) { |
89 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( | 91 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( |
90 new WebKit::WebLayerTreeViewImpl(client)); | 92 new WebKit::WebLayerTreeViewImpl(client)); |
91 if (!layerTreeViewImpl->initialize(settings)) | 93 scoped_ptr<cc::Thread> impl_thread(NULL); |
| 94 if (impl_thread_message_loop_proxy_) |
| 95 impl_thread = cc::ThreadImpl::createForDifferentThread( |
| 96 impl_thread_message_loop_proxy_); |
| 97 if (!layerTreeViewImpl->initialize(settings, impl_thread.Pass())) |
92 return NULL; | 98 return NULL; |
93 layerTreeViewImpl->setRootLayer(root); | 99 layerTreeViewImpl->setRootLayer(root); |
94 return layerTreeViewImpl.release(); | 100 return layerTreeViewImpl.release(); |
95 } | 101 } |
96 | 102 |
97 WebLayer* WebCompositorSupportImpl::createLayer() { | 103 WebLayer* WebCompositorSupportImpl::createLayer() { |
98 return new WebKit::WebLayerImpl(); | 104 return new WebKit::WebLayerImpl(); |
99 } | 105 } |
100 | 106 |
101 WebContentLayer* WebCompositorSupportImpl::createContentLayer( | 107 WebContentLayer* WebCompositorSupportImpl::createContentLayer( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { | 154 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { |
149 return new WebKit::WebFloatAnimationCurveImpl(); | 155 return new WebKit::WebFloatAnimationCurveImpl(); |
150 } | 156 } |
151 | 157 |
152 WebTransformAnimationCurve* | 158 WebTransformAnimationCurve* |
153 WebCompositorSupportImpl::createTransformAnimationCurve() { | 159 WebCompositorSupportImpl::createTransformAnimationCurve() { |
154 return new WebKit::WebTransformAnimationCurveImpl(); | 160 return new WebKit::WebTransformAnimationCurveImpl(); |
155 } | 161 } |
156 | 162 |
157 } // namespace webkit | 163 } // namespace webkit |
OLD | NEW |