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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 #include "ui/base/ui_base_switches.h" | 50 #include "ui/base/ui_base_switches.h" |
51 #include "ui/gfx/rect_conversions.h" | 51 #include "ui/gfx/rect_conversions.h" |
52 #include "ui/gfx/size_conversions.h" | 52 #include "ui/gfx/size_conversions.h" |
53 #include "ui/gfx/skia_util.h" | 53 #include "ui/gfx/skia_util.h" |
54 #include "ui/gl/gl_switches.h" | 54 #include "ui/gl/gl_switches.h" |
55 #include "ui/surface/transport_dib.h" | 55 #include "ui/surface/transport_dib.h" |
56 #include "webkit/glue/webkit_glue.h" | 56 #include "webkit/glue/webkit_glue.h" |
57 #include "webkit/plugins/npapi/webplugin.h" | 57 #include "webkit/plugins/npapi/webplugin.h" |
58 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 58 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
59 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" | 59 #include "webkit/renderer/compositor_bindings/web_rendering_stats_impl.h" |
60 #include "webkit/renderer/compositor_bindings/web_to_ccinput_handler_adapter.h" | |
60 | 61 |
61 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
63 #include "content/renderer/android/synchronous_compositor_impl.h" | |
62 #include "content/renderer/android/synchronous_compositor_output_surface.h" | 64 #include "content/renderer/android/synchronous_compositor_output_surface.h" |
63 #endif | 65 #endif |
64 | 66 |
65 #if defined(OS_POSIX) | 67 #if defined(OS_POSIX) |
66 #include "ipc/ipc_channel_posix.h" | 68 #include "ipc/ipc_channel_posix.h" |
67 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 69 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
68 #include "third_party/skia/include/core/SkPixelRef.h" | 70 #include "third_party/skia/include/core/SkPixelRef.h" |
69 #endif // defined(OS_POSIX) | 71 #endif // defined(OS_POSIX) |
70 | 72 |
71 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" | 73 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 | 575 |
574 bool RenderWidget::ForceCompositingModeEnabled() { | 576 bool RenderWidget::ForceCompositingModeEnabled() { |
575 return false; | 577 return false; |
576 } | 578 } |
577 | 579 |
578 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { | 580 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { |
579 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 581 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
580 | 582 |
581 #if defined(OS_ANDROID) | 583 #if defined(OS_ANDROID) |
582 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { | 584 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { |
583 return scoped_ptr<cc::OutputSurface>( | 585 return GetSynchronousCompositor()->CreateOutputSurface(); |
584 new SynchronousCompositorOutputSurface(routing_id())); | |
585 } | 586 } |
586 #endif | 587 #endif |
587 | 588 |
588 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { | 589 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { |
589 return scoped_ptr<cc::OutputSurface>( | 590 return scoped_ptr<cc::OutputSurface>( |
590 new CompositorOutputSurface(routing_id(), NULL, | 591 new CompositorOutputSurface(routing_id(), NULL, |
591 new CompositorSoftwareOutputDevice())); | 592 new CompositorSoftwareOutputDevice())); |
592 } | 593 } |
593 | 594 |
594 // Explicitly disable antialiasing for the compositor. As of the time of | 595 // Explicitly disable antialiasing for the compositor. As of the time of |
(...skipping 18 matching lines...) Expand all Loading... | |
613 bool composite_to_mailbox = | 614 bool composite_to_mailbox = |
614 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && | 615 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && |
615 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); | 616 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); |
616 // No swap throttling yet when compositing on the main thread. | 617 // No swap throttling yet when compositing on the main thread. |
617 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); | 618 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); |
618 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? | 619 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? |
619 new MailboxOutputSurface(routing_id(), context, NULL) : | 620 new MailboxOutputSurface(routing_id(), context, NULL) : |
620 new CompositorOutputSurface(routing_id(), context, NULL)); | 621 new CompositorOutputSurface(routing_id(), context, NULL)); |
621 } | 622 } |
622 | 623 |
624 scoped_ptr<cc::InputHandlerClient> RenderWidget::CreateInputHandlerClient() { | |
625 scoped_ptr<cc::InputHandlerClient> ret; | |
626 scoped_ptr<WebKit::WebInputHandler> web_handler( | |
627 webwidget_->createInputHandler()); | |
628 if (web_handler) | |
629 ret = WebKit::WebToCCInputHandlerAdapter::create(web_handler.Pass()); | |
630 #if defined(OS_ANDROID) | |
631 if (ret && GetSynchronousCompositor()) { | |
632 ret = GetSynchronousCompositor()->CreateInputHandlerClientWrapper( | |
633 ret.Pass()); | |
634 } | |
635 #endif | |
636 return ret.Pass(); | |
637 } | |
638 | |
639 SynchronousCompositorImpl* RenderWidget::GetSynchronousCompositor() { | |
640 #if defined(OS_ANDROID) | |
641 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
642 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { | |
643 synchronous_compositor_.reset(new SynchronousCompositorImpl(routing_id())); | |
644 } | |
645 return synchronous_compositor_.get(); | |
646 #else | |
647 return NULL; | |
joth
2013/05/16 18:21:42
awkward - this is unreachable as this function is
| |
648 #endif | |
649 } | |
650 | |
623 void RenderWidget::OnViewContextSwapBuffersAborted() { | 651 void RenderWidget::OnViewContextSwapBuffersAborted() { |
624 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); | 652 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); |
625 while (!updates_pending_swap_.empty()) { | 653 while (!updates_pending_swap_.empty()) { |
626 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); | 654 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); |
627 updates_pending_swap_.pop_front(); | 655 updates_pending_swap_.pop_front(); |
628 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate | 656 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate |
629 // compositing pass, hence doesn't require an UpdateRect message. | 657 // compositing pass, hence doesn't require an UpdateRect message. |
630 if (msg) | 658 if (msg) |
631 Send(msg); | 659 Send(msg); |
632 } | 660 } |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2348 | 2376 |
2349 if (!context->Initialize( | 2377 if (!context->Initialize( |
2350 attributes, | 2378 attributes, |
2351 false /* bind generates resources */, | 2379 false /* bind generates resources */, |
2352 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) | 2380 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) |
2353 return NULL; | 2381 return NULL; |
2354 return context.release(); | 2382 return context.release(); |
2355 } | 2383 } |
2356 | 2384 |
2357 } // namespace content | 2385 } // namespace content |
OLD | NEW |