OLD | NEW |
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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "cc/base/switches.h" | 17 #include "cc/base/switches.h" |
18 #include "cc/base/thread.h" | 18 #include "cc/base/thread.h" |
19 #include "cc/base/thread_impl.h" | 19 #include "cc/base/thread_impl.h" |
20 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
21 #include "cc/trees/layer_tree_host.h" | 21 #include "cc/trees/layer_tree_host.h" |
22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
23 #include "content/common/swapped_out_messages.h" | 23 #include "content/common/swapped_out_messages.h" |
24 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
26 #include "content/renderer/gpu/compositor_output_surface.h" | 26 #include "content/renderer/gpu/compositor_output_surface.h" |
27 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" | 27 #include "content/renderer/gpu/compositor_software_output_device.h" |
28 #include "content/renderer/gpu/input_handler_manager.h" | 28 #include "content/renderer/gpu/input_handler_manager.h" |
29 #include "content/renderer/gpu/mailbox_output_surface.h" | 29 #include "content/renderer/gpu/mailbox_output_surface.h" |
30 #include "content/renderer/gpu/render_widget_compositor.h" | 30 #include "content/renderer/gpu/render_widget_compositor.h" |
31 #include "content/renderer/render_process.h" | 31 #include "content/renderer/render_process.h" |
32 #include "content/renderer/render_thread_impl.h" | 32 #include "content/renderer/render_thread_impl.h" |
33 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 33 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
34 #include "ipc/ipc_sync_message.h" | 34 #include "ipc/ipc_sync_message.h" |
35 #include "skia/ext/platform_canvas.h" | 35 #include "skia/ext/platform_canvas.h" |
36 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 36 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
37 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" | 37 #include "third_party/WebKit/Source/Platform/chromium/public/WebPoint.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 WebKit::WebGraphicsContext3D::Attributes attributes; | 569 WebKit::WebGraphicsContext3D::Attributes attributes; |
570 attributes.antialias = false; | 570 attributes.antialias = false; |
571 attributes.shareResources = true; | 571 attributes.shareResources = true; |
572 attributes.noAutomaticFlushes = true; | 572 attributes.noAutomaticFlushes = true; |
573 WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); | 573 WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); |
574 if (!context) | 574 if (!context) |
575 return scoped_ptr<cc::OutputSurface>(); | 575 return scoped_ptr<cc::OutputSurface>(); |
576 | 576 |
577 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 577 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
578 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 578 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
579 // In the absence of a software-based delegating renderer, use this | |
580 // stopgap adapter class to present the software renderer output using a | |
581 // 3d context. | |
582 return scoped_ptr<cc::OutputSurface>( | 579 return scoped_ptr<cc::OutputSurface>( |
583 new CompositorOutputSurface(routing_id(), NULL, | 580 new CompositorOutputSurface(routing_id(), NULL, |
584 new CompositorSoftwareOutputDeviceGLAdapter(context))); | 581 new CompositorSoftwareOutputDevice())); |
585 } else { | 582 } else { |
586 bool composite_to_mailbox = | 583 bool composite_to_mailbox = |
587 command_line.HasSwitch(cc::switches::kCompositeToMailbox); | 584 command_line.HasSwitch(cc::switches::kCompositeToMailbox); |
588 DCHECK(!composite_to_mailbox || command_line.HasSwitch( | 585 DCHECK(!composite_to_mailbox || command_line.HasSwitch( |
589 cc::switches::kEnableCompositorFrameMessage)); | 586 cc::switches::kEnableCompositorFrameMessage)); |
590 // No swap throttling yet when compositing on the main thread. | 587 // No swap throttling yet when compositing on the main thread. |
591 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); | 588 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); |
592 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? | 589 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? |
593 new MailboxOutputSurface(routing_id(), context, NULL) : | 590 new MailboxOutputSurface(routing_id(), context, NULL) : |
594 new CompositorOutputSurface(routing_id(), context, NULL)); | 591 new CompositorOutputSurface(routing_id(), context, NULL)); |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 | 2307 |
2311 if (!context->Initialize( | 2308 if (!context->Initialize( |
2312 attributes, | 2309 attributes, |
2313 false /* bind generates resources */, | 2310 false /* bind generates resources */, |
2314 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2311 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2315 return NULL; | 2312 return NULL; |
2316 return context.release(); | 2313 return context.release(); |
2317 } | 2314 } |
2318 | 2315 |
2319 } // namespace content | 2316 } // namespace content |
OLD | NEW |