| 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" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 // Mac OS X essentially always behaves as though it's rendering offscreen. | 562 // Mac OS X essentially always behaves as though it's rendering offscreen. |
| 563 // Multisampling has a heavy cost especially on devices with relatively low | 563 // Multisampling has a heavy cost especially on devices with relatively low |
| 564 // fill rate like most notebooks, and the Mac implementation would need to | 564 // fill rate like most notebooks, and the Mac implementation would need to |
| 565 // be optimized to resolve directly into the IOSurface shared between the | 565 // be optimized to resolve directly into the IOSurface shared between the |
| 566 // GPU and browser processes. For these reasons and to avoid platform | 566 // GPU and browser processes. For these reasons and to avoid platform |
| 567 // disparities we explicitly disable antialiasing. | 567 // disparities we explicitly disable antialiasing. |
| 568 WebKit::WebGraphicsContext3D::Attributes attributes; | 568 WebKit::WebGraphicsContext3D::Attributes attributes; |
| 569 attributes.antialias = false; | 569 attributes.antialias = false; |
| 570 attributes.shareResources = true; | 570 attributes.shareResources = true; |
| 571 attributes.noAutomaticFlushes = true; | 571 attributes.noAutomaticFlushes = true; |
| 572 WebKit::WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); | 572 WebGraphicsContext3DCommandBufferImpl* context = |
| 573 CreateGraphicsContext3D(attributes); |
| 573 if (!context) | 574 if (!context) |
| 574 return scoped_ptr<cc::OutputSurface>(); | 575 return scoped_ptr<cc::OutputSurface>(); |
| 575 | 576 |
| 576 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 577 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 577 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 578 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
| 578 // In the absence of a software-based delegating renderer, use this | 579 // In the absence of a software-based delegating renderer, use this |
| 579 // stopgap adapter class to present the software renderer output using a | 580 // stopgap adapter class to present the software renderer output using a |
| 580 // 3d context. | 581 // 3d context. |
| 581 return scoped_ptr<cc::OutputSurface>( | 582 return scoped_ptr<cc::OutputSurface>( |
| 582 new CompositorOutputSurface(routing_id(), NULL, | 583 new CompositorOutputSurface(routing_id(), NULL, |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 } | 2294 } |
| 2294 | 2295 |
| 2295 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { | 2296 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { |
| 2296 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 2297 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
| 2297 } | 2298 } |
| 2298 | 2299 |
| 2299 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2300 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
| 2300 return true; | 2301 return true; |
| 2301 } | 2302 } |
| 2302 | 2303 |
| 2303 WebKit::WebGraphicsContext3D* RenderWidget::CreateGraphicsContext3D( | 2304 WebGraphicsContext3DCommandBufferImpl* RenderWidget::CreateGraphicsContext3D( |
| 2304 const WebKit::WebGraphicsContext3D::Attributes& attributes) { | 2305 const WebKit::WebGraphicsContext3D::Attributes& attributes) { |
| 2305 if (!webwidget_) | 2306 if (!webwidget_) |
| 2306 return NULL; | 2307 return NULL; |
| 2307 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 2308 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 2308 new WebGraphicsContext3DCommandBufferImpl( | 2309 new WebGraphicsContext3DCommandBufferImpl( |
| 2309 surface_id(), | 2310 surface_id(), |
| 2310 GetURLForGraphicsContext3D(), | 2311 GetURLForGraphicsContext3D(), |
| 2311 RenderThreadImpl::current(), | 2312 RenderThreadImpl::current(), |
| 2312 weak_ptr_factory_.GetWeakPtr())); | 2313 weak_ptr_factory_.GetWeakPtr())); |
| 2313 | 2314 |
| 2314 if (!context->Initialize( | 2315 if (!context->Initialize( |
| 2315 attributes, | 2316 attributes, |
| 2316 false /* bind generates resources */, | 2317 false /* bind generates resources */, |
| 2317 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2318 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2318 return NULL; | 2319 return NULL; |
| 2319 return context.release(); | 2320 return context.release(); |
| 2320 } | 2321 } |
| 2321 | 2322 |
| 2322 } // namespace content | 2323 } // namespace content |
| OLD | NEW |