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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 return GURL(); | 579 return GURL(); |
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 (GetSynchronousCompositor()) { |
589 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { | 590 return GetSynchronousCompositor()->CreateOutputSurface(); |
590 return scoped_ptr<cc::OutputSurface>( | |
591 new SynchronousCompositorOutputSurface(routing_id())); | |
592 } | 591 } |
593 #endif | |
594 | 592 |
595 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 593 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
596 return scoped_ptr<cc::OutputSurface>( | 594 return scoped_ptr<cc::OutputSurface>( |
597 new CompositorOutputSurface(routing_id(), NULL, | 595 new CompositorOutputSurface(routing_id(), NULL, |
598 new CompositorSoftwareOutputDevice())); | 596 new CompositorSoftwareOutputDevice())); |
599 } | 597 } |
600 | 598 |
601 // Explicitly disable antialiasing for the compositor. As of the time of | 599 // Explicitly disable antialiasing for the compositor. As of the time of |
602 // this writing, the only platform that supported antialiasing for the | 600 // this writing, the only platform that supported antialiasing for the |
603 // compositor was Mac OS X, because the on-screen OpenGL context creation | 601 // compositor was Mac OS X, because the on-screen OpenGL context creation |
(...skipping 20 matching lines...) Expand all Loading... |
624 bool composite_to_mailbox = | 622 bool composite_to_mailbox = |
625 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && | 623 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && |
626 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); | 624 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); |
627 // No swap throttling yet when compositing on the main thread. | 625 // No swap throttling yet when compositing on the main thread. |
628 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); | 626 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); |
629 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? | 627 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? |
630 new MailboxOutputSurface(routing_id(), context, NULL) : | 628 new MailboxOutputSurface(routing_id(), context, NULL) : |
631 new CompositorOutputSurface(routing_id(), context, NULL)); | 629 new CompositorOutputSurface(routing_id(), context, NULL)); |
632 } | 630 } |
633 | 631 |
| 632 SynchronousCompositorImpl* RenderWidget::GetSynchronousCompositor() { |
| 633 #if defined(OS_ANDROID) |
| 634 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 635 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { |
| 636 synchronous_compositor_.reset(new SynchronousCompositorImpl(routing_id())); |
| 637 } |
| 638 return synchronous_compositor_.get(); |
| 639 #else |
| 640 return NULL; |
| 641 #endif |
| 642 } |
| 643 |
634 void RenderWidget::OnViewContextSwapBuffersAborted() { | 644 void RenderWidget::OnViewContextSwapBuffersAborted() { |
635 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); | 645 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); |
636 while (!updates_pending_swap_.empty()) { | 646 while (!updates_pending_swap_.empty()) { |
637 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); | 647 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); |
638 updates_pending_swap_.pop_front(); | 648 updates_pending_swap_.pop_front(); |
639 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate | 649 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate |
640 // compositing pass, hence doesn't require an UpdateRect message. | 650 // compositing pass, hence doesn't require an UpdateRect message. |
641 if (msg) | 651 if (msg) |
642 Send(msg); | 652 Send(msg); |
643 } | 653 } |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2388 | 2398 |
2389 if (!context->Initialize( | 2399 if (!context->Initialize( |
2390 attributes, | 2400 attributes, |
2391 false /* bind generates resources */, | 2401 false /* bind generates resources */, |
2392 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2402 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
2393 return NULL; | 2403 return NULL; |
2394 return context.release(); | 2404 return context.release(); |
2395 } | 2405 } |
2396 | 2406 |
2397 } // namespace content | 2407 } // namespace content |
OLD | NEW |