| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "cc/font_atlas.h" | 11 #include "cc/font_atlas.h" |
| 12 #include "cc/layer.h" | 12 #include "cc/layer.h" |
| 13 #include "cc/layer_tree_debug_state.h" | 13 #include "cc/layer_tree_debug_state.h" |
| 14 #include "cc/layer_tree_host.h" | 14 #include "cc/layer_tree_host.h" |
| 15 #include "cc/switches.h" | 15 #include "cc/switches.h" |
| 16 #include "cc/thread_impl.h" | 16 #include "cc/thread_impl.h" |
| 17 #include "content/renderer/gpu/compositor_thread.h" | 17 #include "content/renderer/gpu/compositor_thread.h" |
| 18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli
ent.h" |
| 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsCo
ntext3D.h" | |
| 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 22 #include "webkit/compositor_bindings/web_layer_impl.h" | 21 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 23 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" | 22 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" |
| 24 | 23 |
| 25 namespace cc { | 24 namespace cc { |
| 26 class Layer; | 25 class Layer; |
| 27 } | 26 } |
| 28 | 27 |
| 29 using WebKit::WebFloatPoint; | 28 using WebKit::WebFloatPoint; |
| 30 using WebKit::WebSize; | 29 using WebKit::WebSize; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 283 } |
| 285 | 284 |
| 286 // TODO(jamesr): This should go through WebWidget | 285 // TODO(jamesr): This should go through WebWidget |
| 287 void RenderWidgetCompositor::didRecreateOutputSurface(bool success) { | 286 void RenderWidgetCompositor::didRecreateOutputSurface(bool success) { |
| 288 client_->didRecreateOutputSurface(success); | 287 client_->didRecreateOutputSurface(success); |
| 289 } | 288 } |
| 290 | 289 |
| 291 // TODO(danakj): This should go through WebWidget | 290 // TODO(danakj): This should go through WebWidget |
| 292 WebKit::WebGraphicsContext3D* RenderWidgetCompositor:: | 291 WebKit::WebGraphicsContext3D* RenderWidgetCompositor:: |
| 293 OffscreenContext3dForMainThread() { | 292 OffscreenContext3dForMainThread() { |
| 294 return WebKit::WebSharedGraphicsContext3D::mainThreadContext(); | 293 return RenderThreadImpl::current()->OffscreenContext3dForMainThread(); |
| 295 } | 294 } |
| 296 | 295 |
| 297 // TODO(danakj): This should go through WebWidget | 296 // TODO(danakj): This should go through WebWidget |
| 298 WebKit::WebGraphicsContext3D* RenderWidgetCompositor:: | 297 WebKit::WebGraphicsContext3D* RenderWidgetCompositor:: |
| 299 OffscreenContext3dForCompositorThread() { | 298 OffscreenContext3dForCompositorThread() { |
| 300 if (!WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext() && | 299 return RenderThreadImpl::current()->OffscreenContext3dForCompositorThread(); |
| 301 !WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext()) | |
| 302 return NULL; | |
| 303 return WebKit::WebSharedGraphicsContext3D::compositorThreadContext(); | |
| 304 } | 300 } |
| 305 | 301 |
| 306 // TODO(danakj): This should go through WebWidget | 302 // TODO(danakj): This should go through WebWidget |
| 307 GrContext* RenderWidgetCompositor::OffscreenGrContextForMainThread() { | 303 GrContext* RenderWidgetCompositor::OffscreenGrContextForMainThread() { |
| 308 return WebKit::WebSharedGraphicsContext3D::mainThreadGrContext(); | 304 return RenderThreadImpl::current()->OffscreenGrContextForMainThread(); |
| 309 } | 305 } |
| 310 | 306 |
| 311 // TODO(danakj): This should go through WebWidget | 307 // TODO(danakj): This should go through WebWidget |
| 312 GrContext* RenderWidgetCompositor::OffscreenGrContextForCompositorThread() { | 308 GrContext* RenderWidgetCompositor::OffscreenGrContextForCompositorThread() { |
| 313 return WebKit::WebSharedGraphicsContext3D::compositorThreadGrContext(); | 309 return RenderThreadImpl::current()->OffscreenGrContextForCompositorThread(); |
| 314 } | 310 } |
| 315 | 311 |
| 316 // TODO(jamesr): This should go through WebWidget | 312 // TODO(jamesr): This should go through WebWidget |
| 317 scoped_ptr<cc::InputHandler> RenderWidgetCompositor::createInputHandler() { | 313 scoped_ptr<cc::InputHandler> RenderWidgetCompositor::createInputHandler() { |
| 318 scoped_ptr<cc::InputHandler> ret; | 314 scoped_ptr<cc::InputHandler> ret; |
| 319 scoped_ptr<WebKit::WebInputHandler> web_handler( | 315 scoped_ptr<WebKit::WebInputHandler> web_handler( |
| 320 client_->createInputHandler()); | 316 client_->createInputHandler()); |
| 321 if (web_handler) | 317 if (web_handler) |
| 322 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); | 318 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); |
| 323 return ret.Pass(); | 319 return ret.Pass(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 353 |
| 358 client_->createFontAtlas(bitmap, ascii_to_web_rect_table, font_height); | 354 client_->createFontAtlas(bitmap, ascii_to_web_rect_table, font_height); |
| 359 | 355 |
| 360 for (int i = 0; i < 128; ++i) | 356 for (int i = 0; i < 128; ++i) |
| 361 ascii_to_rect_table[i] = ascii_to_web_rect_table[i]; | 357 ascii_to_rect_table[i] = ascii_to_web_rect_table[i]; |
| 362 | 358 |
| 363 return cc::FontAtlas::create(bitmap, ascii_to_rect_table, font_height).Pass(); | 359 return cc::FontAtlas::create(bitmap, ascii_to_rect_table, font_height).Pass(); |
| 364 } | 360 } |
| 365 | 361 |
| 366 } // namespace content | 362 } // namespace content |
| OLD | NEW |