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

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

Issue 14888002: Android WebView Merged-Thread Hardware Draw (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move in-process input handler into AwRenderView[Host]Ext Created 7 years, 7 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
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 GURL RenderWidget::GetURLForGraphicsContext3D() { 565 GURL RenderWidget::GetURLForGraphicsContext3D() {
566 return GURL(); 566 return GURL();
567 } 567 }
568 568
569 bool RenderWidget::ForceCompositingModeEnabled() { 569 bool RenderWidget::ForceCompositingModeEnabled() {
570 return false; 570 return false;
571 } 571 }
572 572
573 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { 573 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
574 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 574 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
575
576 #if defined(OS_ANDROID)
577 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) {
578 return scoped_ptr<cc::OutputSurface>(
579 new SynchronousCompositorOutputSurface(routing_id()));
580 }
581 #endif
582
575 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { 583 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
576 return scoped_ptr<cc::OutputSurface>( 584 return scoped_ptr<cc::OutputSurface>(
577 new CompositorOutputSurface(routing_id(), NULL, 585 new CompositorOutputSurface(routing_id(), NULL,
578 new CompositorSoftwareOutputDevice())); 586 new CompositorSoftwareOutputDevice()));
579 } 587 }
580 588
581 // Explicitly disable antialiasing for the compositor. As of the time of 589 // Explicitly disable antialiasing for the compositor. As of the time of
582 // this writing, the only platform that supported antialiasing for the 590 // this writing, the only platform that supported antialiasing for the
583 // compositor was Mac OS X, because the on-screen OpenGL context creation 591 // compositor was Mac OS X, because the on-screen OpenGL context creation
584 // code paths on Windows and Linux didn't yet have multisampling support. 592 // code paths on Windows and Linux didn't yet have multisampling support.
585 // Mac OS X essentially always behaves as though it's rendering offscreen. 593 // Mac OS X essentially always behaves as though it's rendering offscreen.
586 // Multisampling has a heavy cost especially on devices with relatively low 594 // Multisampling has a heavy cost especially on devices with relatively low
587 // fill rate like most notebooks, and the Mac implementation would need to 595 // fill rate like most notebooks, and the Mac implementation would need to
588 // be optimized to resolve directly into the IOSurface shared between the 596 // be optimized to resolve directly into the IOSurface shared between the
589 // GPU and browser processes. For these reasons and to avoid platform 597 // GPU and browser processes. For these reasons and to avoid platform
590 // disparities we explicitly disable antialiasing. 598 // disparities we explicitly disable antialiasing.
591 WebKit::WebGraphicsContext3D::Attributes attributes; 599 WebKit::WebGraphicsContext3D::Attributes attributes;
592 attributes.antialias = false; 600 attributes.antialias = false;
593 attributes.shareResources = true; 601 attributes.shareResources = true;
594 attributes.noAutomaticFlushes = true; 602 attributes.noAutomaticFlushes = true;
595 WebGraphicsContext3DCommandBufferImpl* context = 603 WebGraphicsContext3DCommandBufferImpl* context =
596 CreateGraphicsContext3D(attributes); 604 CreateGraphicsContext3D(attributes);
597 if (!context) 605 if (!context)
598 return scoped_ptr<cc::OutputSurface>(); 606 return scoped_ptr<cc::OutputSurface>();
599 607
600 #if defined(OS_ANDROID)
601 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) {
602 // TODO(joth): Move above the |context| creation step above when the
603 // SynchronousCompositor no longer depends on externally created context.
604 return scoped_ptr<cc::OutputSurface>(
605 new SynchronousCompositorOutputSurface(routing_id(),
606 context));
607 }
608 #endif
609
610 bool composite_to_mailbox = 608 bool composite_to_mailbox =
611 command_line.HasSwitch(cc::switches::kCompositeToMailbox); 609 command_line.HasSwitch(cc::switches::kCompositeToMailbox);
612 DCHECK(!composite_to_mailbox || command_line.HasSwitch( 610 DCHECK(!composite_to_mailbox || command_line.HasSwitch(
613 cc::switches::kEnableCompositorFrameMessage)); 611 cc::switches::kEnableCompositorFrameMessage));
614 // No swap throttling yet when compositing on the main thread. 612 // No swap throttling yet when compositing on the main thread.
615 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); 613 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
616 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? 614 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
617 new MailboxOutputSurface(routing_id(), context, NULL) : 615 new MailboxOutputSurface(routing_id(), context, NULL) :
618 new CompositorOutputSurface(routing_id(), context, NULL)); 616 new CompositorOutputSurface(routing_id(), context, NULL));
619 } 617 }
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 2338
2341 if (!context->Initialize( 2339 if (!context->Initialize(
2342 attributes, 2340 attributes,
2343 false /* bind generates resources */, 2341 false /* bind generates resources */,
2344 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2342 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2345 return NULL; 2343 return NULL;
2346 return context.release(); 2344 return context.release();
2347 } 2345 }
2348 2346
2349 } // namespace content 2347 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698