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

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: Rebase to 165064 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 "cc/thread_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 #include "webkit/glue/webthread_impl.h"
24 25
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 webkit_glue::WebThreadImpl* web_thread_impl = static_cast<webkit_glue::WebTh readImpl*>(impl_thread);
61 MessageLoop* impl_message_loop = web_thread_impl->message_loop();
62 impl_thread_ = cc::ThreadImpl::createForDifferentThread(impl_message_loop->m essage_loop_proxy()).release();
63 }
60 } 64 }
61 65
62 bool WebCompositorSupportImpl::isThreadingEnabled() { 66 bool WebCompositorSupportImpl::isThreadingEnabled() {
63 return WebCompositorImpl::isThreadingEnabled(); 67 return !!impl_thread_;
64 } 68 }
65 69
66 void WebCompositorSupportImpl::shutdown() { 70 void WebCompositorSupportImpl::shutdown() {
67 WebCompositorImpl::shutdown();
68 } 71 }
69 72
70 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) { 73 void WebCompositorSupportImpl::setPerTilePaintingEnabled(bool enabled) {
71 cc::Settings::setPerTilePaintingEnabled(enabled); 74 cc::Settings::setPerTilePaintingEnabled(enabled);
72 } 75 }
73 76
74 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) { 77 void WebCompositorSupportImpl::setPartialSwapEnabled(bool enabled) {
75 cc::Settings::setPartialSwapEnabled(enabled); 78 cc::Settings::setPartialSwapEnabled(enabled);
76 } 79 }
77 80
78 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) { 81 void WebCompositorSupportImpl::setAcceleratedAnimationEnabled(bool enabled) {
79 cc::Settings::setAcceleratedAnimationEnabled(enabled); 82 cc::Settings::setAcceleratedAnimationEnabled(enabled);
80 } 83 }
81 84
82 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) { 85 void WebCompositorSupportImpl::setPageScalePinchZoomEnabled(bool enabled) {
83 cc::Settings::setPageScalePinchZoomEnabled(enabled); 86 cc::Settings::setPageScalePinchZoomEnabled(enabled);
84 } 87 }
85 88
86 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView( 89 WebLayerTreeView* WebCompositorSupportImpl::createLayerTreeView(
87 WebLayerTreeViewClient* client, const WebLayer& root, 90 WebLayerTreeViewClient* client, const WebLayer& root,
88 const WebLayerTreeView::Settings& settings) { 91 const WebLayerTreeView::Settings& settings) {
89 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl( 92 scoped_ptr<WebKit::WebLayerTreeViewImpl> layerTreeViewImpl(
90 new WebKit::WebLayerTreeViewImpl(client)); 93 new WebKit::WebLayerTreeViewImpl(client));
91 if (!layerTreeViewImpl->initialize(settings)) 94 if (!layerTreeViewImpl->initialize(settings, impl_thread_))
jamesr 2012/10/31 04:42:13 this passes ownership of impl_thread_ to the cc::L
92 return NULL; 95 return NULL;
93 layerTreeViewImpl->setRootLayer(root); 96 layerTreeViewImpl->setRootLayer(root);
94 return layerTreeViewImpl.release(); 97 return layerTreeViewImpl.release();
95 } 98 }
96 99
97 WebLayer* WebCompositorSupportImpl::createLayer() { 100 WebLayer* WebCompositorSupportImpl::createLayer() {
98 return new WebKit::WebLayerImpl(); 101 return new WebKit::WebLayerImpl();
99 } 102 }
100 103
101 WebContentLayer* WebCompositorSupportImpl::createContentLayer( 104 WebContentLayer* WebCompositorSupportImpl::createContentLayer(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() { 151 WebFloatAnimationCurve* WebCompositorSupportImpl::createFloatAnimationCurve() {
149 return new WebKit::WebFloatAnimationCurveImpl(); 152 return new WebKit::WebFloatAnimationCurveImpl();
150 } 153 }
151 154
152 WebTransformAnimationCurve* 155 WebTransformAnimationCurve*
153 WebCompositorSupportImpl::createTransformAnimationCurve() { 156 WebCompositorSupportImpl::createTransformAnimationCurve() {
154 return new WebKit::WebTransformAnimationCurveImpl(); 157 return new WebKit::WebTransformAnimationCurveImpl();
155 } 158 }
156 159
157 } // namespace webkit 160 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698