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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 | 337 |
337 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::createOutputSurface() { | 338 scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::createOutputSurface() { |
338 return widget_->CreateOutputSurface(); | 339 return widget_->CreateOutputSurface(); |
339 } | 340 } |
340 | 341 |
341 // TODO(jamesr): This should go through WebWidget | 342 // TODO(jamesr): This should go through WebWidget |
342 void RenderWidgetCompositor::didRecreateOutputSurface(bool success) { | 343 void RenderWidgetCompositor::didRecreateOutputSurface(bool success) { |
343 client_->didRecreateOutputSurface(success); | 344 client_->didRecreateOutputSurface(success); |
344 } | 345 } |
345 | 346 |
347 // TODO(danakj): This should go through WebWidget | |
348 WebKit::WebGraphicsContext3D* | |
349 RenderWidgetCompositor::OffscreenContext3dForMainThread() { | |
350 return WebKit::WebSharedGraphicsContext3D::mainThreadContext(); | |
351 } | |
352 | |
353 // TODO(danakj): This should go through WebWidget | |
354 WebKit::WebGraphicsContext3D* | |
355 RenderWidgetCompositor::OffscreenContext3dForCompositorThread() { | |
356 if (!WebKit::WebSharedGraphicsContext3D::haveCompositorThreadContext() && | |
357 !WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext()) | |
358 return NULL; | |
359 return WebKit::WebSharedGraphicsContext3D::compositorThreadContext(); | |
piman
2013/02/13 19:13:31
WebSharedGraphicsContext3D::compositorThreadContex
danakj
2013/02/13 20:57:23
I think this one is okay, it just does this:
P
| |
360 } | |
361 | |
362 // TODO(danakj): This should go through WebWidget | |
363 GrContext* RenderWidgetCompositor::OffscreenGrContextForMainThread() { | |
364 return WebKit::WebSharedGraphicsContext3D::mainThreadGrContext(); | |
365 } | |
366 | |
367 // TODO(danakj): This should go through WebWidget | |
368 GrContext* RenderWidgetCompositor::OffscreenGrContextForCompositorThread() { | |
369 return WebKit::WebSharedGraphicsContext3D::compositorThreadGrContext(); | |
piman
2013/02/13 19:13:31
Same here, I think this will break if called on th
danakj
2013/02/13 20:57:23
Right.. ok I'll have to make the gr context creati
| |
370 } | |
371 | |
372 // TODO(danakj): This should go through WebWidget | |
373 void RenderWidgetCompositor::DestroyOffscreenContext3dForCompositorThread() { | |
374 WebKit::WebSharedGraphicsContext3D::createCompositorThreadContext(); | |
375 } | |
376 | |
346 // TODO(jamesr): This should go through WebWidget | 377 // TODO(jamesr): This should go through WebWidget |
347 scoped_ptr<cc::InputHandler> RenderWidgetCompositor::createInputHandler() { | 378 scoped_ptr<cc::InputHandler> RenderWidgetCompositor::createInputHandler() { |
348 scoped_ptr<cc::InputHandler> ret; | 379 scoped_ptr<cc::InputHandler> ret; |
349 scoped_ptr<WebKit::WebInputHandler> web_handler( | 380 scoped_ptr<WebKit::WebInputHandler> web_handler( |
350 client_->createInputHandler()); | 381 client_->createInputHandler()); |
351 if (web_handler) | 382 if (web_handler) |
352 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); | 383 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); |
353 return ret.Pass(); | 384 return ret.Pass(); |
354 } | 385 } |
355 | 386 |
(...skipping 29 matching lines...) Expand all Loading... | |
385 | 416 |
386 client_->createFontAtlas(bitmap, ascii_to_web_rect_table, font_height); | 417 client_->createFontAtlas(bitmap, ascii_to_web_rect_table, font_height); |
387 | 418 |
388 for (int i = 0; i < 128; ++i) | 419 for (int i = 0; i < 128; ++i) |
389 ascii_to_rect_table[i] = ascii_to_web_rect_table[i]; | 420 ascii_to_rect_table[i] = ascii_to_web_rect_table[i]; |
390 | 421 |
391 return cc::FontAtlas::create(bitmap, ascii_to_rect_table, font_height).Pass(); | 422 return cc::FontAtlas::create(bitmap, ascii_to_rect_table, font_height).Pass(); |
392 } | 423 } |
393 | 424 |
394 } // namespace content | 425 } // namespace content |
OLD | NEW |