Chromium Code Reviews| 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(); | |
| 63 } else { | |
| 64 impl_thread_message_loop_proxy_ = NULL; | |
|
jamesr
2012/11/03 00:13:13
could you do this in ::shutdown() ?
| |
| 65 } | |
| 60 } | 66 } |
| 61 | 67 |
| 62 bool WebCompositorSupportImpl::isThreadingEnabled() { | 68 bool WebCompositorSupportImpl::isThreadingEnabled() { |
| 63 return WebCompositorImpl::isThreadingEnabled(); | 69 return impl_thread_message_loop_proxy_; |
| 64 } | 70 } |
| 65 | 71 |
| 66 void WebCompositorSupportImpl::shutdown() { | 72 void WebCompositorSupportImpl::shutdown() { |
| 67 WebCompositorImpl::shutdown(); | |
| 68 } | 73 } |
| 69 | 74 |
| 70 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { | 75 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { |
| 71 cc::Settings::setPerTilePaintingEnabled(enabled); | 76 cc::Settings::setPerTilePaintingEnabled(enabled); |
| 72 } | 77 } |
| 73 | 78 |
| 74 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { | 79 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { |
| 75 cc::Settings::setPartialSwapEnabled(enabled); | 80 cc::Settings::setPartialSwapEnabled(enabled); |
| 76 } | 81 } |
| 77 | 82 |
| 78 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { | 83 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { |
| 79 cc::Settings::setAcceleratedAnimationEnabled(enabled); | 84 cc::Settings::setAcceleratedAnimationEnabled(enabled); |
| 80 } | 85 } |
| 81 | 86 |
| 82 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { | 87 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { |
| 83 cc::Settings::setPageScalePinchZoomEnabled(enabled); | 88 cc::Settings::setPageScalePinchZoomEnabled(enabled); |
| 84 } | 89 } |
| 85 | 90 |
| 86 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( | 91 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( |
| 87 WebLayerTreeViewClient* client, const WebLayer& root, | 92 WebLayerTreeViewClient* client, const WebLayer& root, |
| 88 const WebLayerTreeView::Settings& settings) { | 93 const WebLayerTreeView::Settings& settings) { |
| 89 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( | 94 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( |
| 90 new WebKit::WebLayerTreeViewImpl(client)); | 95 new WebKit::WebLayerTreeViewImpl(client)); |
| 91 if (!layerTreeViewImpl->initialize(settings)) | 96 scoped_ptr<cc::Thread> impl_thread(NULL); |
| 97 if (impl_thread_message_loop_proxy_) | |
| 98 impl_thread = cc::ThreadImpl::createForDifferentThread( | |
| 99 impl_thread_message_loop_proxy_); | |
| 100 if (!layerTreeViewImpl->initialize(settings, impl_thread.Pass())) | |
| 92 return NULL; | 101 return NULL; |
| 93 layerTreeViewImpl->setRootLayer(root); | 102 layerTreeViewImpl->setRootLayer(root); |
| 94 return layerTreeViewImpl.release(); | 103 return layerTreeViewImpl.release(); |
| 95 } | 104 } |
| 96 | 105 |
| 97 WebLayer* WebCompositorSupportImpl::createLayer() { | 106 WebLayer* WebCompositorSupportImpl::createLayer() { |
| 98 return new WebKit::WebLayerImpl(); | 107 return new WebKit::WebLayerImpl(); |
| 99 } | 108 } |
| 100 | 109 |
| 101 WebContentLayer* WebCompositorSupportImpl::createContentLayer( | 110 WebContentLayer* WebCompositorSupportImpl::createContentLayer( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { | 157 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { |
| 149 return new WebKit::WebFloatAnimationCurveImpl(); | 158 return new WebKit::WebFloatAnimationCurveImpl(); |
| 150 } | 159 } |
| 151 | 160 |
| 152 WebTransformAnimationCurve* | 161 WebTransformAnimationCurve* |
| 153 WebCompositorSupportImpl::createTransformAnimationCurve() { | 162 WebCompositorSupportImpl::createTransformAnimationCurve() { |
| 154 return new WebKit::WebTransformAnimationCurveImpl(); | 163 return new WebKit::WebTransformAnimationCurveImpl(); |
| 155 } | 164 } |
| 156 | 165 |
| 157 } // namespace webkit | 166 } // namespace webkit |
| OLD | NEW |