Chromium Code Reviews| Index: webkit/compositor_bindings/web_compositor_support_impl.cc |
| diff --git a/webkit/compositor_bindings/web_compositor_support_impl.cc b/webkit/compositor_bindings/web_compositor_support_impl.cc |
| index 6d237be7755e04f0cdf5d1ac6f6c45eb96759312..b470a163b456fdc259c478203625039a73ad42f8 100644 |
| --- a/webkit/compositor_bindings/web_compositor_support_impl.cc |
| +++ b/webkit/compositor_bindings/web_compositor_support_impl.cc |
| @@ -7,9 +7,10 @@ |
| #include "base/debug/trace_event.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/message_loop_proxy.h" |
| #include "cc/settings.h" |
| +#include "cc/thread_impl.h" |
| #include "webkit/compositor_bindings/web_animation_impl.h" |
| -#include "webkit/compositor_bindings/web_compositor_impl.h" |
| #include "webkit/compositor_bindings/web_content_layer_impl.h" |
| #include "webkit/compositor_bindings/web_delegated_renderer_layer_impl.h" |
| #include "webkit/compositor_bindings/web_external_texture_layer_impl.h" |
| @@ -22,6 +23,7 @@ |
| #include "webkit/compositor_bindings/web_solid_color_layer_impl.h" |
| #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h" |
| #include "webkit/compositor_bindings/web_video_layer_impl.h" |
| +#include "webkit/glue/webthread_impl.h" |
| using WebKit::WebAnimation; |
| using WebKit::WebAnimationCurve; |
| @@ -46,29 +48,36 @@ using WebKit::WebTransformAnimationCurve; |
| using WebKit::WebVideoFrameProvider; |
| using WebKit::WebVideoLayer; |
| -using WebKit::WebCompositorImpl; |
| - |
| namespace webkit { |
| -WebCompositorSupportImpl::WebCompositorSupportImpl() { |
| +WebCompositorSupportImpl::WebCompositorSupportImpl() |
| + : initialized_(false) { |
| } |
| WebCompositorSupportImpl::~WebCompositorSupportImpl() { |
| } |
| -void WebCompositorSupportImpl::initialize(WebKit::WebThread* thread) { |
| - if (thread) { |
| +void WebCompositorSupportImpl::initialize(WebKit::WebThread* impl_thread) { |
| + DCHECK(!initialized_); |
| + initialized_ = true; |
| + if (impl_thread) { |
| TRACE_EVENT_INSTANT0("test_gpu", "ThreadedCompositingInitialization"); |
| + impl_thread_message_loop_proxy_ = |
| + static_cast<webkit_glue::WebThreadImpl*>(impl_thread)-> |
| + message_loop()->message_loop_proxy(); |
| + } else { |
| + impl_thread_message_loop_proxy_ = NULL; |
| } |
| - WebCompositorImpl::initialize(thread); |
| } |
| bool WebCompositorSupportImpl::isThreadingEnabled() { |
| - return WebCompositorImpl::isThreadingEnabled(); |
| + return impl_thread_message_loop_proxy_; |
| } |
| void WebCompositorSupportImpl::shutdown() { |
| - WebCompositorImpl::shutdown(); |
| + DCHECK(initialized_); |
| + initialized_ = false; |
| + impl_thread_message_loop_proxy_ = NULL; |
| } |
| void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { |
| @@ -90,9 +99,14 @@ void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { |
| WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( |
| WebLayerTreeViewClient* client, const WebLayer& root, |
| const WebLayerTreeView::Settings& settings) { |
| + DCHECK(initialized_); |
| scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( |
| new WebKit::WebLayerTreeViewImpl(client)); |
| - if (!layerTreeViewImpl->initialize(settings)) |
| + scoped_ptr<cc::Thread> impl_thread(NULL); |
|
jamesr
2012/11/08 03:03:16
nit: you don't need the (NULL) here - the default
|
| + if (impl_thread_message_loop_proxy_) |
| + impl_thread = cc::ThreadImpl::createForDifferentThread( |
| + impl_thread_message_loop_proxy_); |
| + if (!layerTreeViewImpl->initialize(settings, impl_thread.Pass())) |
| return NULL; |
| layerTreeViewImpl->setRootLayer(root); |
| return layerTreeViewImpl.release(); |