| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 DCHECK(!never_visible_); | 937 DCHECK(!never_visible_); |
| 938 | 938 |
| 939 #if defined(OS_ANDROID) | 939 #if defined(OS_ANDROID) |
| 940 if (SynchronousCompositorFactory* factory = | 940 if (SynchronousCompositorFactory* factory = |
| 941 SynchronousCompositorFactory::GetInstance()) { | 941 SynchronousCompositorFactory::GetInstance()) { |
| 942 return factory->CreateOutputSurface(routing_id(), | 942 return factory->CreateOutputSurface(routing_id(), |
| 943 frame_swap_message_queue_); | 943 frame_swap_message_queue_); |
| 944 } | 944 } |
| 945 #endif | 945 #endif |
| 946 | 946 |
| 947 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 947 const base::CommandLine& command_line = |
| 948 *base::CommandLine::ForCurrentProcess(); |
| 948 bool use_software = fallback; | 949 bool use_software = fallback; |
| 949 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 950 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
| 950 use_software = true; | 951 use_software = true; |
| 951 | 952 |
| 952 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 953 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| 953 if (!use_software) { | 954 if (!use_software) { |
| 954 context_provider = ContextProviderCommandBuffer::Create( | 955 context_provider = ContextProviderCommandBuffer::Create( |
| 955 CreateGraphicsContext3D(), "RenderCompositor"); | 956 CreateGraphicsContext3D(), "RenderCompositor"); |
| 956 if (!context_provider.get()) { | 957 if (!context_provider.get()) { |
| 957 // Cause the compositor to wait and try again. | 958 // Cause the compositor to wait and try again. |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2200 bool RenderWidget::WillHandleGestureEvent( | 2201 bool RenderWidget::WillHandleGestureEvent( |
| 2201 const blink::WebGestureEvent& event) { | 2202 const blink::WebGestureEvent& event) { |
| 2202 return false; | 2203 return false; |
| 2203 } | 2204 } |
| 2204 | 2205 |
| 2205 void RenderWidget::ObserveWheelEventOnAndResult( | 2206 void RenderWidget::ObserveWheelEventOnAndResult( |
| 2206 const blink::WebMouseWheelEvent& wheel_event, | 2207 const blink::WebMouseWheelEvent& wheel_event, |
| 2207 bool event_processed) { | 2208 bool event_processed) { |
| 2208 bool observe_wheel_event = false; | 2209 bool observe_wheel_event = false; |
| 2209 #if defined(OS_MACOSX) | 2210 #if defined(OS_MACOSX) |
| 2210 observe_wheel_event = CommandLine::ForCurrentProcess()->HasSwitch( | 2211 observe_wheel_event = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2211 switches::kEnableThreadedEventHandlingMac); | 2212 switches::kEnableThreadedEventHandlingMac); |
| 2212 #endif | 2213 #endif |
| 2213 if (!observe_wheel_event) | 2214 if (!observe_wheel_event) |
| 2214 return; | 2215 return; |
| 2215 | 2216 |
| 2216 // Blink does not accurately compute scroll bubbling or overscroll. For now, | 2217 // Blink does not accurately compute scroll bubbling or overscroll. For now, |
| 2217 // assume that an unprocessed event was entirely an overscroll, and that a | 2218 // assume that an unprocessed event was entirely an overscroll, and that a |
| 2218 // processed event was entirely scroll. | 2219 // processed event was entirely scroll. |
| 2219 // TODO(ccameron): Retrieve an accurate scroll result from Blink. | 2220 // TODO(ccameron): Retrieve an accurate scroll result from Blink. |
| 2220 // http://crbug.com/442859 | 2221 // http://crbug.com/442859 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 } | 2279 } |
| 2279 | 2280 |
| 2280 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2281 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
| 2281 return true; | 2282 return true; |
| 2282 } | 2283 } |
| 2283 | 2284 |
| 2284 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 2285 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 2285 RenderWidget::CreateGraphicsContext3D() { | 2286 RenderWidget::CreateGraphicsContext3D() { |
| 2286 if (!webwidget_) | 2287 if (!webwidget_) |
| 2287 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2288 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| 2288 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2289 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2289 switches::kDisableGpuCompositing)) | 2290 switches::kDisableGpuCompositing)) |
| 2290 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2291 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| 2291 if (!RenderThreadImpl::current()) | 2292 if (!RenderThreadImpl::current()) |
| 2292 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2293 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| 2293 CauseForGpuLaunch cause = | 2294 CauseForGpuLaunch cause = |
| 2294 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 2295 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
| 2295 scoped_refptr<GpuChannelHost> gpu_channel_host( | 2296 scoped_refptr<GpuChannelHost> gpu_channel_host( |
| 2296 RenderThreadImpl::current()->EstablishGpuChannelSync(cause)); | 2297 RenderThreadImpl::current()->EstablishGpuChannelSync(cause)); |
| 2297 if (!gpu_channel_host.get()) | 2298 if (!gpu_channel_host.get()) |
| 2298 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2299 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2370 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2370 video_hole_frames_.AddObserver(frame); | 2371 video_hole_frames_.AddObserver(frame); |
| 2371 } | 2372 } |
| 2372 | 2373 |
| 2373 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2374 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2374 video_hole_frames_.RemoveObserver(frame); | 2375 video_hole_frames_.RemoveObserver(frame); |
| 2375 } | 2376 } |
| 2376 #endif // defined(VIDEO_HOLE) | 2377 #endif // defined(VIDEO_HOLE) |
| 2377 | 2378 |
| 2378 } // namespace content | 2379 } // namespace content |
| OLD | NEW |