Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: content/renderer/render_widget.cc

Issue 15875009: Refactor SynchronousCompositor out of SynchronousCompositorOutputSurface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix rebase mistake Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_impl.h"
65 #include "content/renderer/android/synchronous_compositor_output_surface.h" 66 #include "content/renderer/android/synchronous_compositor_output_surface.h"
66 #endif 67 #endif
67 68
68 #if defined(OS_POSIX) 69 #if defined(OS_POSIX)
69 #include "ipc/ipc_channel_posix.h" 70 #include "ipc/ipc_channel_posix.h"
70 #include "third_party/skia/include/core/SkMallocPixelRef.h" 71 #include "third_party/skia/include/core/SkMallocPixelRef.h"
71 #include "third_party/skia/include/core/SkPixelRef.h" 72 #include "third_party/skia/include/core/SkPixelRef.h"
72 #endif // defined(OS_POSIX) 73 #endif // defined(OS_POSIX)
73 74
74 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" 75 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 579 }
579 580
580 bool RenderWidget::ForceCompositingModeEnabled() { 581 bool RenderWidget::ForceCompositingModeEnabled() {
581 return false; 582 return false;
582 } 583 }
583 584
584 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { 585 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
585 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 586 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
586 587
587 #if defined(OS_ANDROID) 588 #if defined(OS_ANDROID)
588 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) { 589 if (GetSynchronousCompositor()) {
589 return scoped_ptr<cc::OutputSurface>( 590 return GetSynchronousCompositor()->CreateOutputSurface();
590 new SynchronousCompositorOutputSurface(routing_id()));
591 } 591 }
592 #endif 592 #endif
593 593
594 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { 594 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
595 return scoped_ptr<cc::OutputSurface>( 595 return scoped_ptr<cc::OutputSurface>(
596 new CompositorOutputSurface(routing_id(), NULL, 596 new CompositorOutputSurface(routing_id(), NULL,
597 new CompositorSoftwareOutputDevice())); 597 new CompositorSoftwareOutputDevice()));
598 } 598 }
599 599
600 // Explicitly disable antialiasing for the compositor. As of the time of 600 // Explicitly disable antialiasing for the compositor. As of the time of
(...skipping 22 matching lines...) Expand all
623 bool composite_to_mailbox = 623 bool composite_to_mailbox =
624 command_line.HasSwitch(cc::switches::kCompositeToMailbox) && 624 command_line.HasSwitch(cc::switches::kCompositeToMailbox) &&
625 !command_line.HasSwitch(switches::kEnableDelegatedRenderer); 625 !command_line.HasSwitch(switches::kEnableDelegatedRenderer);
626 // No swap throttling yet when compositing on the main thread. 626 // No swap throttling yet when compositing on the main thread.
627 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); 627 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
628 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? 628 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
629 new MailboxOutputSurface(routing_id(), context, NULL) : 629 new MailboxOutputSurface(routing_id(), context, NULL) :
630 new CompositorOutputSurface(routing_id(), context, NULL)); 630 new CompositorOutputSurface(routing_id(), context, NULL));
631 } 631 }
632 632
633 #if defined(OS_ANDROID)
634 SynchronousCompositorImpl* RenderWidget::GetSynchronousCompositor() {
635 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
636 if (!synchronous_compositor_ &&
637 command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) {
638 synchronous_compositor_.reset(new SynchronousCompositorImpl(routing_id()));
639 }
640 return synchronous_compositor_.get();
641 }
642 #endif
643
633 void RenderWidget::OnViewContextSwapBuffersAborted() { 644 void RenderWidget::OnViewContextSwapBuffersAborted() {
634 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); 645 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted");
635 while (!updates_pending_swap_.empty()) { 646 while (!updates_pending_swap_.empty()) {
636 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); 647 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front();
637 updates_pending_swap_.pop_front(); 648 updates_pending_swap_.pop_front();
638 // 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
639 // compositing pass, hence doesn't require an UpdateRect message. 650 // compositing pass, hence doesn't require an UpdateRect message.
640 if (msg) 651 if (msg)
641 Send(msg); 652 Send(msg);
642 } 653 }
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 2392
2382 if (!context->Initialize( 2393 if (!context->Initialize(
2383 attributes, 2394 attributes,
2384 false /* bind generates resources */, 2395 false /* bind generates resources */,
2385 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2396 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2386 return NULL; 2397 return NULL;
2387 return context.release(); 2398 return context.release();
2388 } 2399 }
2389 2400
2390 } // namespace content 2401 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698