| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "ui/gfx/skia_util.h" | 55 #include "ui/gfx/skia_util.h" |
| 56 #include "ui/gl/gl_switches.h" | 56 #include "ui/gl/gl_switches.h" |
| 57 #include "ui/surface/transport_dib.h" | 57 #include "ui/surface/transport_dib.h" |
| 58 #include "webkit/glue/cursor_utils.h" | 58 #include "webkit/glue/cursor_utils.h" |
| 59 #include "webkit/glue/webkit_glue.h" | 59 #include "webkit/glue/webkit_glue.h" |
| 60 #include "webkit/plugins/npapi/webplugin.h" | 60 #include "webkit/plugins/npapi/webplugin.h" |
| 61 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 61 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 62 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 62 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
| 63 | 63 |
| 64 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
| 65 #include "content/renderer/android/synchronous_compositor_output_surface.h" | 65 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 #if defined(OS_POSIX) | 68 #if defined(OS_POSIX) |
| 69 #include "ipc/ipc_channel_posix.h" | 69 #include "ipc/ipc_channel_posix.h" |
| 70 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 70 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 71 #include "third_party/skia/include/core/SkPixelRef.h" | 71 #include "third_party/skia/include/core/SkPixelRef.h" |
| 72 #endif // defined(OS_POSIX) | 72 #endif // defined(OS_POSIX) |
| 73 | 73 |
| 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
| 75 | 75 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (!is_swapped_out) | 298 if (!is_swapped_out) |
| 299 RenderProcess::current()->AddRefProcess(); | 299 RenderProcess::current()->AddRefProcess(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 bool RenderWidget::AllowPartialSwap() const { | 302 bool RenderWidget::AllowPartialSwap() const { |
| 303 return true; | 303 return true; |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool RenderWidget::UsingSynchronousRendererCompositor() const { | 306 bool RenderWidget::UsingSynchronousRendererCompositor() const { |
| 307 #if defined(OS_ANDROID) | 307 #if defined(OS_ANDROID) |
| 308 if (CommandLine::ForCurrentProcess()->HasSwitch( | 308 return SynchronousCompositorFactory::HasInstance(); |
| 309 switches::kEnableSynchronousRendererCompositor)) { | |
| 310 return true; | |
| 311 } | |
| 312 #endif | 309 #endif |
| 313 return false; | 310 return false; |
| 314 } | 311 } |
| 315 | 312 |
| 316 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { | 313 bool RenderWidget::OnMessageReceived(const IPC::Message& message) { |
| 317 bool handled = true; | 314 bool handled = true; |
| 318 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) | 315 IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) |
| 319 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) | 316 IPC_MESSAGE_HANDLER(InputMsg_HandleInputEvent, OnHandleInputEvent) |
| 320 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, | 317 IPC_MESSAGE_HANDLER(InputMsg_CursorVisibilityChange, |
| 321 OnCursorVisibilityChange) | 318 OnCursorVisibilityChange) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 } | 575 } |
| 579 | 576 |
| 580 bool RenderWidget::ForceCompositingModeEnabled() { | 577 bool RenderWidget::ForceCompositingModeEnabled() { |
| 581 return false; | 578 return false; |
| 582 } | 579 } |
| 583 | 580 |
| 584 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { | 581 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { |
| 585 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 582 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 586 | 583 |
| 587 #if defined(OS_ANDROID) | 584 #if defined(OS_ANDROID) |
| 588 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { | 585 if (SynchronousCompositorFactory::HasInstance()) { |
| 589 return scoped_ptr<cc::OutputSurface>( | 586 return SynchronousCompositorFactory::GetInstance()->CreateOutputSurface( |
| 590 new SynchronousCompositorOutputSurface(routing_id())); | 587 routing_id()); |
| 591 } | 588 } |
| 592 #endif | 589 #endif |
| 593 | 590 |
| 594 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 591 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
| 595 return scoped_ptr<cc::OutputSurface>( | 592 return scoped_ptr<cc::OutputSurface>( |
| 596 new CompositorOutputSurface(routing_id(), NULL, | 593 new CompositorOutputSurface(routing_id(), NULL, |
| 597 new CompositorSoftwareOutputDevice())); | 594 new CompositorSoftwareOutputDevice())); |
| 598 } | 595 } |
| 599 | 596 |
| 600 // Explicitly disable antialiasing for the compositor. As of the time of | 597 // Explicitly disable antialiasing for the compositor. As of the time of |
| (...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 | 2378 |
| 2382 if (!context->Initialize( | 2379 if (!context->Initialize( |
| 2383 attributes, | 2380 attributes, |
| 2384 false /* bind generates resources */, | 2381 false /* bind generates resources */, |
| 2385 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2382 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2386 return NULL; | 2383 return NULL; |
| 2387 return context.release(); | 2384 return context.release(); |
| 2388 } | 2385 } |
| 2389 | 2386 |
| 2390 } // namespace content | 2387 } // namespace content |
| OLD | NEW |