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" |
20 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
21 #include "webkit/compositor_bindings/web_layer_impl.h" | 22 #include "webkit/compositor_bindings/web_layer_impl.h" |
22 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" | 23 #include "webkit/compositor_bindings/web_to_ccinput_handler_adapter.h" |
23 | 24 |
24 namespace cc { | 25 namespace cc { |
25 class Layer; | 26 class Layer; |
26 } | 27 } |
27 | 28 |
28 using WebKit::WebFloatPoint; | 29 using WebKit::WebFloatPoint; |
29 using WebKit::WebSize; | 30 using WebKit::WebSize; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 334 |
334 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::createOutputSurface() { | 335 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::createOutputSurface() { |
335 return widget_->CreateOutputSurface(); | 336 return widget_->CreateOutputSurface(); |
336 } | 337 } |
337 | 338 |
338 // TODO(jamesr): This should go through WebWidget | 339 // TODO(jamesr): This should go through WebWidget |
339 void RenderWidgetCompositor::didRecreateOutputSurface(bool success) { | 340 void RenderWidgetCompositor::didRecreateOutputSurface(bool success) { |
340 client_->didRecreateOutputSurface(success); | 341 client_->didRecreateOutputSurface(success); |
341 } | 342 } |
342 | 343 |
| 344 // TODO(danakj): This hook is just meant for testing, remove it when we track |
| 345 // losing the offscreen context in the embedder! The getter methods should |
| 346 // return a new valid context after a loss automatically. |
| 347 void RenderWidgetCompositor::willRetryRecreateOutputSurface() { |
| 348 if (WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext()) |
| 349 WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext(); |
| 350 } |
| 351 |
| 352 // TODO(danakj): This should go through WebWidget |
| 353 WebKit::WebGraphicsContext3D* RenderWidgetCompositor:: |
| 354 OffscreenContext3dForMainThread() { |
| 355 return WebKit::WebSharedGraphicsContext3D::mainThreadContext(); |
| 356 } |
| 357 |
| 358 // TODO(danakj): This should go through WebWidget |
| 359 WebKit::WebGraphicsContext3D* RenderWidgetCompositor:: |
| 360 OffscreenContext3dForCompositorThread() { |
| 361 if (!WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext() && |
| 362 !WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext()) |
| 363 return NULL; |
| 364 return WebKit::WebSharedGraphicsContext3D::compositorThreadContext(); |
| 365 } |
| 366 |
343 // TODO(jamesr): This should go through WebWidget | 367 // TODO(jamesr): This should go through WebWidget |
344 scoped_ptr<cc::InputHandler> RenderWidgetCompositor::createInputHandler() { | 368 scoped_ptr<cc::InputHandler> RenderWidgetCompositor::createInputHandler() { |
345 scoped_ptr<cc::InputHandler> ret; | 369 scoped_ptr<cc::InputHandler> ret; |
346 scoped_ptr<WebKit::WebInputHandler> web_handler( | 370 scoped_ptr<WebKit::WebInputHandler> web_handler( |
347 client_->createInputHandler()); | 371 client_->createInputHandler()); |
348 if (web_handler) | 372 if (web_handler) |
349 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); | 373 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); |
350 return ret.Pass(); | 374 return ret.Pass(); |
351 } | 375 } |
352 | 376 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 408 |
385 client_->createFontAtlas(bitmap, ascii_to_web_rect_table, font_height); | 409 client_->createFontAtlas(bitmap, ascii_to_web_rect_table, font_height); |
386 | 410 |
387 for (int i = 0; i < 128; ++i) | 411 for (int i = 0; i < 128; ++i) |
388 ascii_to_rect_table[i] = ascii_to_web_rect_table[i]; | 412 ascii_to_rect_table[i] = ascii_to_web_rect_table[i]; |
389 | 413 |
390 return cc::FontAtlas::create(bitmap, ascii_to_rect_table, font_height).Pass(); | 414 return cc::FontAtlas::create(bitmap, ascii_to_rect_table, font_height).Pass(); |
391 } | 415 } |
392 | 416 |
393 } // namespace content | 417 } // namespace content |
OLD | NEW |