| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 // Mac OS X essentially always behaves as though it's rendering offscreen. | 569 // Mac OS X essentially always behaves as though it's rendering offscreen. |
| 570 // Multisampling has a heavy cost especially on devices with relatively low | 570 // Multisampling has a heavy cost especially on devices with relatively low |
| 571 // fill rate like most notebooks, and the Mac implementation would need to | 571 // fill rate like most notebooks, and the Mac implementation would need to |
| 572 // be optimized to resolve directly into the IOSurface shared between the | 572 // be optimized to resolve directly into the IOSurface shared between the |
| 573 // GPU and browser processes. For these reasons and to avoid platform | 573 // GPU and browser processes. For these reasons and to avoid platform |
| 574 // disparities we explicitly disable antialiasing. | 574 // disparities we explicitly disable antialiasing. |
| 575 WebKit::WebGraphicsContext3D::Attributes attributes; | 575 WebKit::WebGraphicsContext3D::Attributes attributes; |
| 576 attributes.antialias = false; | 576 attributes.antialias = false; |
| 577 attributes.shareResources = true; | 577 attributes.shareResources = true; |
| 578 attributes.noAutomaticFlushes = true; | 578 attributes.noAutomaticFlushes = true; |
| 579 WebKit::WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); | 579 WebGraphicsContext3DCommandBufferImpl* context = |
| 580 CreateGraphicsContext3D(attributes); |
| 580 if (!context) | 581 if (!context) |
| 581 return scoped_ptr<cc::OutputSurface>(); | 582 return scoped_ptr<cc::OutputSurface>(); |
| 582 | 583 |
| 583 bool composite_to_mailbox = | 584 bool composite_to_mailbox = |
| 584 command_line.HasSwitch(cc::switches::kCompositeToMailbox); | 585 command_line.HasSwitch(cc::switches::kCompositeToMailbox); |
| 585 DCHECK(!composite_to_mailbox || command_line.HasSwitch( | 586 DCHECK(!composite_to_mailbox || command_line.HasSwitch( |
| 586 cc::switches::kEnableCompositorFrameMessage)); | 587 cc::switches::kEnableCompositorFrameMessage)); |
| 587 // No swap throttling yet when compositing on the main thread. | 588 // No swap throttling yet when compositing on the main thread. |
| 588 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); | 589 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); |
| 589 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? | 590 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? |
| (...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 } | 2291 } |
| 2291 | 2292 |
| 2292 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { | 2293 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { |
| 2293 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 2294 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
| 2294 } | 2295 } |
| 2295 | 2296 |
| 2296 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2297 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
| 2297 return true; | 2298 return true; |
| 2298 } | 2299 } |
| 2299 | 2300 |
| 2300 WebKit::WebGraphicsContext3D* RenderWidget::CreateGraphicsContext3D( | 2301 WebGraphicsContext3DCommandBufferImpl* RenderWidget::CreateGraphicsContext3D( |
| 2301 const WebKit::WebGraphicsContext3D::Attributes& attributes) { | 2302 const WebKit::WebGraphicsContext3D::Attributes& attributes) { |
| 2302 if (!webwidget_) | 2303 if (!webwidget_) |
| 2303 return NULL; | 2304 return NULL; |
| 2304 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 2305 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 2305 new WebGraphicsContext3DCommandBufferImpl( | 2306 new WebGraphicsContext3DCommandBufferImpl( |
| 2306 surface_id(), | 2307 surface_id(), |
| 2307 GetURLForGraphicsContext3D(), | 2308 GetURLForGraphicsContext3D(), |
| 2308 RenderThreadImpl::current(), | 2309 RenderThreadImpl::current(), |
| 2309 weak_ptr_factory_.GetWeakPtr())); | 2310 weak_ptr_factory_.GetWeakPtr())); |
| 2310 | 2311 |
| 2311 if (!context->Initialize( | 2312 if (!context->Initialize( |
| 2312 attributes, | 2313 attributes, |
| 2313 false /* bind generates resources */, | 2314 false /* bind generates resources */, |
| 2314 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2315 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2315 return NULL; | 2316 return NULL; |
| 2316 return context.release(); | 2317 return context.release(); |
| 2317 } | 2318 } |
| 2318 | 2319 |
| 2319 } // namespace content | 2320 } // namespace content |
| OLD | NEW |