Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: webkit/compositor_bindings/web_compositor_support_impl.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address code review comments and fix all cc_unittests Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/settings.h" 9 #include "cc/settings.h"
10 #include "webkit/compositor_bindings/ccthread_impl.h"
10 #include "webkit/compositor_bindings/web_animation_impl.h" 11 #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" 12 #include "webkit/compositor_bindings/web_content_layer_impl.h"
13 #include "webkit/compositor_bindings/web_delegated_renderer_layer_impl.h" 13 #include "webkit/compositor_bindings/web_delegated_renderer_layer_impl.h"
14 #include "webkit/compositor_bindings/web_external_texture_layer_impl.h" 14 #include "webkit/compositor_bindings/web_external_texture_layer_impl.h"
15 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h" 15 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h"
16 #include "webkit/compositor_bindings/web_image_layer_impl.h" 16 #include "webkit/compositor_bindings/web_image_layer_impl.h"
17 #include "webkit/compositor_bindings/web_io_surface_layer_impl.h" 17 #include "webkit/compositor_bindings/web_io_surface_layer_impl.h"
18 #include "webkit/compositor_bindings/web_layer_impl.h" 18 #include "webkit/compositor_bindings/web_layer_impl.h"
19 #include "webkit/compositor_bindings/web_layer_tree_view_impl.h" 19 #include "webkit/compositor_bindings/web_layer_tree_view_impl.h"
20 #include "webkit/compositor_bindings/web_scrollbar_layer_impl.h" 20 #include "webkit/compositor_bindings/web_scrollbar_layer_impl.h"
21 #include "webkit/compositor_bindings/web_solid_color_layer_impl.h" 21 #include "webkit/compositor_bindings/web_solid_color_layer_impl.h"
22 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h" 22 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h"
23 #include "webkit/compositor_bindings/web_video_layer_impl.h" 23 #include "webkit/compositor_bindings/web_video_layer_impl.h"
24 24
25 using WebKit::CCThreadImpl;
25 using WebKit::WebAnimation; 26 using WebKit::WebAnimation;
26 using WebKit::WebAnimationCurve; 27 using WebKit::WebAnimationCurve;
27 using WebKit::WebContentLayer; 28 using WebKit::WebContentLayer;
28 using WebKit::WebContentLayerClient; 29 using WebKit::WebContentLayerClient;
29 using WebKit::WebDelegatedRendererLayer; 30 using WebKit::WebDelegatedRendererLayer;
30 using WebKit::WebExternalTextureLayer; 31 using WebKit::WebExternalTextureLayer;
31 using WebKit::WebExternalTextureLayerClient; 32 using WebKit::WebExternalTextureLayerClient;
32 using WebKit::WebFloatAnimationCurve; 33 using WebKit::WebFloatAnimationCurve;
33 using WebKit::WebIOSurfaceLayer; 34 using WebKit::WebIOSurfaceLayer;
34 using WebKit::WebImageLayer; 35 using WebKit::WebImageLayer;
35 using WebKit::WebImageLayer; 36 using WebKit::WebImageLayer;
36 using WebKit::WebLayer; 37 using WebKit::WebLayer;
37 using WebKit::WebLayerTreeView; 38 using WebKit::WebLayerTreeView;
38 using WebKit::WebLayerTreeViewClient; 39 using WebKit::WebLayerTreeViewClient;
39 using WebKit::WebScrollbar; 40 using WebKit::WebScrollbar;
40 using WebKit::WebScrollbarLayer; 41 using WebKit::WebScrollbarLayer;
41 using WebKit::WebScrollbarThemeGeometry; 42 using WebKit::WebScrollbarThemeGeometry;
42 using WebKit::WebScrollbarThemePainter; 43 using WebKit::WebScrollbarThemePainter;
43 using WebKit::WebSolidColorLayer; 44 using WebKit::WebSolidColorLayer;
44 using WebKit::WebTransformAnimationCurve; 45 using WebKit::WebTransformAnimationCurve;
45 using WebKit::WebVideoFrameProvider; 46 using WebKit::WebVideoFrameProvider;
46 using WebKit::WebVideoLayer; 47 using WebKit::WebVideoLayer;
47 48
48 using WebKit::WebCompositorImpl;
49
50 namespace webkit { 49 namespace webkit {
51 50
52 WebCompositorSupportImpl::WebCompositorSupportImpl() { 51 WebCompositorSupportImpl::WebCompositorSupportImpl()
52 : impl_thread_(NULL) {
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_ = CCThreadImpl::createForDifferentThread(impl_thread)
61 .release();
60 } 62 }
61 63
62 bool WebCompositorSupportImpl::isThreadingEnabled() { 64 bool WebCompositorSupportImpl::isThreadingEnabled() {
63 return WebCompositorImpl::isThreadingEnabled(); 65 return !!impl_thread_;
64 } 66 }
65 67
66 void WebCompositorSupportImpl::shutdown() { 68 void WebCompositorSupportImpl::shutdown() {
67 WebCompositorImpl::shutdown();
68 } 69 }
69 70
70 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { 71 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) {
71 cc::Settings::setPerTilePaintingEnabled(enabled); 72 cc::Settings::setPerTilePaintingEnabled(enabled);
72 } 73 }
73 74
74 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { 75 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) {
75 cc::Settings::setPartialSwapEnabled(enabled); 76 cc::Settings::setPartialSwapEnabled(enabled);
76 } 77 }
77 78
78 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { 79 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) {
79 cc::Settings::setAcceleratedAnimationEnabled(enabled); 80 cc::Settings::setAcceleratedAnimationEnabled(enabled);
80 } 81 }
81 82
82 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { 83 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) {
83 cc::Settings::setPageScalePinchZoomEnabled(enabled); 84 cc::Settings::setPageScalePinchZoomEnabled(enabled);
84 } 85 }
85 86
86 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( 87 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView(
87 WebLayerTreeViewClient* client, const WebLayer& root, 88 WebLayerTreeViewClient* client, const WebLayer& root,
88 const WebLayerTreeView::Settings& settings) { 89 const WebLayerTreeView::Settings& settings) {
89 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( 90 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl(
90 new WebKit::WebLayerTreeViewImpl(client)); 91 new WebKit::WebLayerTreeViewImpl(client));
91 if (!layerTreeViewImpl->initialize(settings)) 92 if (!layerTreeViewImpl->initialize(settings, impl_thread_))
92 return NULL; 93 return NULL;
93 layerTreeViewImpl->setRootLayer(root); 94 layerTreeViewImpl->setRootLayer(root);
94 return layerTreeViewImpl.release(); 95 return layerTreeViewImpl.release();
95 } 96 }
96 97
97 WebLayer* WebCompositorSupportImpl::createLayer() { 98 WebLayer* WebCompositorSupportImpl::createLayer() {
98 return new WebKit::WebLayerImpl(); 99 return new WebKit::WebLayerImpl();
99 } 100 }
100 101
101 WebContentLayer* WebCompositorSupportImpl::createContentLayer( 102 WebContentLayer* WebCompositorSupportImpl::createContentLayer(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { 149 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() {
149 return new WebKit::WebFloatAnimationCurveImpl(); 150 return new WebKit::WebFloatAnimationCurveImpl();
150 } 151 }
151 152
152 WebTransformAnimationCurve* 153 WebTransformAnimationCurve*
153 WebCompositorSupportImpl::createTransformAnimationCurve() { 154 WebCompositorSupportImpl::createTransformAnimationCurve() {
154 return new WebKit::WebTransformAnimationCurveImpl(); 155 return new WebKit::WebTransformAnimationCurveImpl();
155 } 156 }
156 157
157 } // namespace webkit 158 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698