| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "ui/gfx/size_conversions.h" | 54 #include "ui/gfx/size_conversions.h" |
| 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/webkit_glue.h" | 58 #include "webkit/glue/webkit_glue.h" |
| 59 #include "webkit/plugins/npapi/webplugin.h" | 59 #include "webkit/plugins/npapi/webplugin.h" |
| 60 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 60 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 61 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 61 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
| 62 | 62 |
| 63 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
| 64 #include "content/renderer/android/synchronous_compositor_impl.h" |
| 64 #include "content/renderer/android/synchronous_compositor_output_surface.h" | 65 #include "content/renderer/android/synchronous_compositor_output_surface.h" |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 #if defined(OS_POSIX) | 68 #if defined(OS_POSIX) |
| 68 #include "ipc/ipc_channel_posix.h" | 69 #include "ipc/ipc_channel_posix.h" |
| 69 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 70 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
| 70 #include "third_party/skia/include/core/SkPixelRef.h" | 71 #include "third_party/skia/include/core/SkPixelRef.h" |
| 71 #endif // defined(OS_POSIX) | 72 #endif // defined(OS_POSIX) |
| 72 | 73 |
| 73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 580 } |
| 580 | 581 |
| 581 bool RenderWidget::ForceCompositingModeEnabled() { | 582 bool RenderWidget::ForceCompositingModeEnabled() { |
| 582 return false; | 583 return false; |
| 583 } | 584 } |
| 584 | 585 |
| 585 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { | 586 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { |
| 586 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 587 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 587 | 588 |
| 588 #if defined(OS_ANDROID) | 589 #if defined(OS_ANDROID) |
| 589 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { | 590 if (GetSynchronousCompositor()) { |
| 590 return scoped_ptr<cc::OutputSurface>( | 591 return GetSynchronousCompositor()->CreateOutputSurface(); |
| 591 new SynchronousCompositorOutputSurface(routing_id())); | |
| 592 } | 592 } |
| 593 #endif | 593 #endif |
| 594 | 594 |
| 595 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 595 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
| 596 return scoped_ptr<cc::OutputSurface>( | 596 return scoped_ptr<cc::OutputSurface>( |
| 597 new CompositorOutputSurface(routing_id(), NULL, | 597 new CompositorOutputSurface(routing_id(), NULL, |
| 598 new CompositorSoftwareOutputDevice())); | 598 new CompositorSoftwareOutputDevice())); |
| 599 } | 599 } |
| 600 | 600 |
| 601 // Explicitly disable antialiasing for the compositor. As of the time of | 601 // Explicitly disable antialiasing for the compositor. As of the time of |
| (...skipping 22 matching lines...) Expand all Loading... |
| 624 bool composite_to_mailbox = | 624 bool composite_to_mailbox = |
| 625 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && | 625 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && |
| 626 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); | 626 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); |
| 627 // No swap throttling yet when compositing on the main thread. | 627 // No swap throttling yet when compositing on the main thread. |
| 628 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); | 628 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); |
| 629 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? | 629 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? |
| 630 new MailboxOutputSurface(routing_id(), context, NULL) : | 630 new MailboxOutputSurface(routing_id(), context, NULL) : |
| 631 new CompositorOutputSurface(routing_id(), context, NULL)); | 631 new CompositorOutputSurface(routing_id(), context, NULL)); |
| 632 } | 632 } |
| 633 | 633 |
| 634 #if defined(OS_ANDROID) |
| 635 SynchronousCompositorImpl* RenderWidget::GetSynchronousCompositor() { |
| 636 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 637 if (!synchronous_compositor_ && |
| 638 command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { |
| 639 synchronous_compositor_.reset(new SynchronousCompositorImpl(routing_id())); |
| 640 } |
| 641 return synchronous_compositor_.get(); |
| 642 } |
| 643 #endif |
| 644 |
| 634 void RenderWidget::OnViewContextSwapBuffersAborted() { | 645 void RenderWidget::OnViewContextSwapBuffersAborted() { |
| 635 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); | 646 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); |
| 636 while (!updates_pending_swap_.empty()) { | 647 while (!updates_pending_swap_.empty()) { |
| 637 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); | 648 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); |
| 638 updates_pending_swap_.pop_front(); | 649 updates_pending_swap_.pop_front(); |
| 639 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate | 650 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate |
| 640 // compositing pass, hence doesn't require an UpdateRect message. | 651 // compositing pass, hence doesn't require an UpdateRect message. |
| 641 if (msg) | 652 if (msg) |
| 642 Send(msg); | 653 Send(msg); |
| 643 } | 654 } |
| (...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 | 2399 |
| 2389 if (!context->Initialize( | 2400 if (!context->Initialize( |
| 2390 attributes, | 2401 attributes, |
| 2391 false /* bind generates resources */, | 2402 false /* bind generates resources */, |
| 2392 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2403 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2393 return NULL; | 2404 return NULL; |
| 2394 return context.release(); | 2405 return context.release(); |
| 2395 } | 2406 } |
| 2396 | 2407 |
| 2397 } // namespace content | 2408 } // namespace content |
| OLD | NEW |