OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/compositor/compositor_cc.h" | 5 #include "ui/gfx/compositor/compositor_cc.h" |
6 | 6 |
7 #include "third_party/skia/include/images/SkImageEncoder.h" | 7 #include "third_party/skia/include/images/SkImageEncoder.h" |
8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFloatPoint.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 WebKit::WebLayerTreeView::Settings settings; | 127 WebKit::WebLayerTreeView::Settings settings; |
128 settings.enableCompositorThread = !!g_compositor_thread; | 128 settings.enableCompositorThread = !!g_compositor_thread; |
129 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings); | 129 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings); |
130 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); | 130 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); |
131 OnWidgetSizeChanged(); | 131 OnWidgetSizeChanged(); |
132 } | 132 } |
133 | 133 |
134 CompositorCC::~CompositorCC() { | 134 CompositorCC::~CompositorCC() { |
135 } | 135 } |
136 | 136 |
137 void CompositorCC::InitializeThread() { | 137 void CompositorCC::Initialize(bool use_thread) { |
138 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); | 138 if (use_thread) |
139 WebKit::WebCompositor::setThread(g_compositor_thread); | 139 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); |
140 #if WEBCOMPOSITOR_HAS_INITIALIZE | |
141 WebKit::WebCompositor::initialize(g_compositor_thread); | |
142 #else | |
143 if (use_thread) | |
144 WebKit::WebCompositor::setThread(g_compositor_thread); | |
145 #endif | |
140 } | 146 } |
141 | 147 |
142 void CompositorCC::TerminateThread() { | 148 void CompositorCC::Terminate() { |
149 #if WEBCOMPOSITOR_HAS_INITIALIZE | |
150 WebKit::WebCompositor::shutdown(); | |
151 #endif | |
143 DCHECK(g_compositor_thread); | 152 DCHECK(g_compositor_thread); |
piman
2011/11/18 23:21:56
remove DCHECK, since it'll fail if use_thread == f
| |
144 delete g_compositor_thread; | 153 delete g_compositor_thread; |
145 g_compositor_thread = NULL; | 154 g_compositor_thread = NULL; |
146 } | 155 } |
147 | 156 |
148 Texture* CompositorCC::CreateTexture() { | 157 Texture* CompositorCC::CreateTexture() { |
149 NOTREACHED(); | 158 NOTREACHED(); |
150 return NULL; | 159 return NULL; |
151 } | 160 } |
152 | 161 |
153 void CompositorCC::Blur(const gfx::Rect& bounds) { | 162 void CompositorCC::Blur(const gfx::Rect& bounds) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 ScheduleDraw(); | 235 ScheduleDraw(); |
227 } | 236 } |
228 | 237 |
229 Compositor* Compositor::Create(CompositorDelegate* owner, | 238 Compositor* Compositor::Create(CompositorDelegate* owner, |
230 gfx::AcceleratedWidget widget, | 239 gfx::AcceleratedWidget widget, |
231 const gfx::Size& size) { | 240 const gfx::Size& size) { |
232 return new CompositorCC(owner, widget, size); | 241 return new CompositorCC(owner, widget, size); |
233 } | 242 } |
234 | 243 |
235 } // namespace ui | 244 } // namespace ui |
OLD | NEW |