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

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: address comments 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 GURL RenderWidget::GetURLForGraphicsContext3D() { 553 GURL RenderWidget::GetURLForGraphicsContext3D() {
554 return GURL(); 554 return GURL();
555 } 555 }
556 556
557 bool RenderWidget::ForceCompositingModeEnabled() { 557 bool RenderWidget::ForceCompositingModeEnabled() {
558 return false; 558 return false;
559 } 559 }
560 560
561 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { 561 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
562 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 562 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
563
564 #if defined(OS_ANDROID)
565 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) {
566 return scoped_ptr<cc::OutputSurface>(
567 new SynchronousCompositorOutputSurface(routing_id()));
568 }
569 #endif
570
563 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { 571 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
564 return scoped_ptr<cc::OutputSurface>( 572 return scoped_ptr<cc::OutputSurface>(
565 new CompositorOutputSurface(routing_id(), NULL, 573 new CompositorOutputSurface(routing_id(), NULL,
566 new CompositorSoftwareOutputDevice())); 574 new CompositorSoftwareOutputDevice()));
567 } 575 }
568 576
569 // Explicitly disable antialiasing for the compositor. As of the time of 577 // Explicitly disable antialiasing for the compositor. As of the time of
570 // this writing, the only platform that supported antialiasing for the 578 // this writing, the only platform that supported antialiasing for the
571 // compositor was Mac OS X, because the on-screen OpenGL context creation 579 // compositor was Mac OS X, because the on-screen OpenGL context creation
572 // code paths on Windows and Linux didn't yet have multisampling support. 580 // code paths on Windows and Linux didn't yet have multisampling support.
573 // Mac OS X essentially always behaves as though it's rendering offscreen. 581 // Mac OS X essentially always behaves as though it's rendering offscreen.
574 // Multisampling has a heavy cost especially on devices with relatively low 582 // Multisampling has a heavy cost especially on devices with relatively low
575 // fill rate like most notebooks, and the Mac implementation would need to 583 // fill rate like most notebooks, and the Mac implementation would need to
576 // be optimized to resolve directly into the IOSurface shared between the 584 // be optimized to resolve directly into the IOSurface shared between the
577 // GPU and browser processes. For these reasons and to avoid platform 585 // GPU and browser processes. For these reasons and to avoid platform
578 // disparities we explicitly disable antialiasing. 586 // disparities we explicitly disable antialiasing.
579 WebKit::WebGraphicsContext3D::Attributes attributes; 587 WebKit::WebGraphicsContext3D::Attributes attributes;
580 attributes.antialias = false; 588 attributes.antialias = false;
581 attributes.shareResources = true; 589 attributes.shareResources = true;
582 attributes.noAutomaticFlushes = true; 590 attributes.noAutomaticFlushes = true;
583 WebGraphicsContext3DCommandBufferImpl* context = 591 WebGraphicsContext3DCommandBufferImpl* context =
584 CreateGraphicsContext3D(attributes); 592 CreateGraphicsContext3D(attributes);
585 if (!context) 593 if (!context)
586 return scoped_ptr<cc::OutputSurface>(); 594 return scoped_ptr<cc::OutputSurface>();
587 595
588 #if defined(OS_ANDROID)
589 if (command_line.HasSwitch(switches::kEnableSynchronousRendererCompositor)) {
590 // TODO(joth): Move above the |context| creation step above when the
591 // SynchronousCompositor no longer depends on externally created context.
592 return scoped_ptr<cc::OutputSurface>(
593 new SynchronousCompositorOutputSurface(routing_id(),
594 context));
595 }
596 #endif
597
598 bool composite_to_mailbox = 596 bool composite_to_mailbox =
599 command_line.HasSwitch(cc::switches::kCompositeToMailbox); 597 command_line.HasSwitch(cc::switches::kCompositeToMailbox);
600 DCHECK(!composite_to_mailbox || command_line.HasSwitch( 598 DCHECK(!composite_to_mailbox || command_line.HasSwitch(
601 cc::switches::kEnableCompositorFrameMessage)); 599 cc::switches::kEnableCompositorFrameMessage));
602 // No swap throttling yet when compositing on the main thread. 600 // No swap throttling yet when compositing on the main thread.
603 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); 601 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
604 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? 602 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
605 new MailboxOutputSurface(routing_id(), context, NULL) : 603 new MailboxOutputSurface(routing_id(), context, NULL) :
606 new CompositorOutputSurface(routing_id(), context, NULL)); 604 new CompositorOutputSurface(routing_id(), context, NULL));
607 } 605 }
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 2321
2324 if (!context->Initialize( 2322 if (!context->Initialize(
2325 attributes, 2323 attributes,
2326 false /* bind generates resources */, 2324 false /* bind generates resources */,
2327 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2325 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2328 return NULL; 2326 return NULL;
2329 return context.release(); 2327 return context.release();
2330 } 2328 }
2331 2329
2332 } // namespace content 2330 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698