| 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 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "cc/thread_impl.h" | 9 #include "cc/thread_impl.h" |
| 10 #include "cc/transform_operations.h" | 10 #include "cc/transform_operations.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 bool WebCompositorSupportImpl::isThreadingEnabled() { | 73 bool WebCompositorSupportImpl::isThreadingEnabled() { |
| 74 return impl_thread_message_loop_proxy_; | 74 return impl_thread_message_loop_proxy_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void WebCompositorSupportImpl::shutdown() { | 77 void WebCompositorSupportImpl::shutdown() { |
| 78 DCHECK(initialized_); | 78 DCHECK(initialized_); |
| 79 initialized_ = false; | 79 initialized_ = false; |
| 80 impl_thread_message_loop_proxy_ = NULL; | 80 impl_thread_message_loop_proxy_ = NULL; |
| 81 } | 81 } |
| 82 | 82 |
| 83 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( | |
| 84 WebLayerTreeViewClient* client, const WebLayer& root, | |
| 85 const WebLayerTreeView::Settings& settings) { | |
| 86 DCHECK(initialized_); | |
| 87 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( | |
| 88 new WebKit::WebLayerTreeViewImpl(client)); | |
| 89 scoped_ptr<cc::Thread> impl_thread; | |
| 90 if (impl_thread_message_loop_proxy_) | |
| 91 impl_thread = cc::ThreadImpl::createForDifferentThread( | |
| 92 impl_thread_message_loop_proxy_); | |
| 93 if (!layerTreeViewImpl->initialize(settings, impl_thread.Pass())) | |
| 94 return NULL; | |
| 95 layerTreeViewImpl->setRootLayer(root); | |
| 96 return layerTreeViewImpl.release(); | |
| 97 } | |
| 98 | |
| 99 WebKit::WebCompositorOutputSurface* | 83 WebKit::WebCompositorOutputSurface* |
| 100 WebCompositorSupportImpl::createOutputSurfaceFor3D( | 84 WebCompositorSupportImpl::createOutputSurfaceFor3D( |
| 101 WebKit::WebGraphicsContext3D* context) { | 85 WebKit::WebGraphicsContext3D* context) { |
| 102 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = make_scoped_ptr(context); | 86 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = make_scoped_ptr(context); |
| 103 return WebCompositorSupportOutputSurface::Create3d( | 87 return WebCompositorSupportOutputSurface::Create3d( |
| 104 context3d.Pass()).release(); | 88 context3d.Pass()).release(); |
| 105 } | 89 } |
| 106 | 90 |
| 107 WebKit::WebCompositorOutputSurface* | 91 WebKit::WebCompositorOutputSurface* |
| 108 WebCompositorSupportImpl::createOutputSurfaceForSoftware() { | 92 WebCompositorSupportImpl::createOutputSurfaceForSoftware() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 148 |
| 165 WebTransformAnimationCurve* | 149 WebTransformAnimationCurve* |
| 166 WebCompositorSupportImpl::createTransformAnimationCurve() { | 150 WebCompositorSupportImpl::createTransformAnimationCurve() { |
| 167 return new WebKit::WebTransformAnimationCurveImpl(); | 151 return new WebKit::WebTransformAnimationCurveImpl(); |
| 168 } | 152 } |
| 169 | 153 |
| 170 WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() { | 154 WebTransformOperations* WebCompositorSupportImpl::createTransformOperations() { |
| 171 return new WebTransformOperationsImpl(); | 155 return new WebTransformOperationsImpl(); |
| 172 } | 156 } |
| 173 | 157 |
| 158 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( |
| 159 WebLayerTreeViewClient* client, const WebLayer& root, |
| 160 const WebLayerTreeView::Settings& settings) { |
| 161 DCHECK(initialized_); |
| 162 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( |
| 163 new WebKit::WebLayerTreeViewImpl(client)); |
| 164 scoped_ptr<cc::Thread> impl_thread; |
| 165 if (impl_thread_message_loop_proxy_) |
| 166 impl_thread = cc::ThreadImpl::createForDifferentThread( |
| 167 impl_thread_message_loop_proxy_); |
| 168 if (!layerTreeViewImpl->initialize(settings, impl_thread.Pass())) |
| 169 return NULL; |
| 170 layerTreeViewImpl->setRootLayer(root); |
| 171 return layerTreeViewImpl.release(); |
| 172 } |
| 173 |
| 174 } // namespace webkit | 174 } // namespace webkit |
| OLD | NEW |