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

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

Issue 12614013: Plumb cc::LatencyInfo through command buffer and output surface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 GURL RenderWidget::GetURLForGraphicsContext3D() { 544 GURL RenderWidget::GetURLForGraphicsContext3D() {
545 return GURL(); 545 return GURL();
546 } 546 }
547 547
548 bool RenderWidget::ForceCompositingModeEnabled() { 548 bool RenderWidget::ForceCompositingModeEnabled() {
549 return false; 549 return false;
550 } 550 }
551 551
552 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() { 552 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface() {
553 CommandBufferProxyImpl* proxy = NULL;
553 // Explicitly disable antialiasing for the compositor. As of the time of 554 // Explicitly disable antialiasing for the compositor. As of the time of
554 // this writing, the only platform that supported antialiasing for the 555 // this writing, the only platform that supported antialiasing for the
555 // compositor was Mac OS X, because the on-screen OpenGL context creation 556 // compositor was Mac OS X, because the on-screen OpenGL context creation
556 // code paths on Windows and Linux didn't yet have multisampling support. 557 // code paths on Windows and Linux didn't yet have multisampling support.
557 // Mac OS X essentially always behaves as though it's rendering offscreen. 558 // Mac OS X essentially always behaves as though it's rendering offscreen.
558 // Multisampling has a heavy cost especially on devices with relatively low 559 // Multisampling has a heavy cost especially on devices with relatively low
559 // fill rate like most notebooks, and the Mac implementation would need to 560 // fill rate like most notebooks, and the Mac implementation would need to
560 // be optimized to resolve directly into the IOSurface shared between the 561 // be optimized to resolve directly into the IOSurface shared between the
561 // GPU and browser processes. For these reasons and to avoid platform 562 // GPU and browser processes. For these reasons and to avoid platform
562 // disparities we explicitly disable antialiasing. 563 // disparities we explicitly disable antialiasing.
563 WebKit::WebGraphicsContext3D::Attributes attributes; 564 WebKit::WebGraphicsContext3D::Attributes attributes;
564 attributes.antialias = false; 565 attributes.antialias = false;
565 attributes.shareResources = true; 566 attributes.shareResources = true;
566 attributes.noAutomaticFlushes = true; 567 attributes.noAutomaticFlushes = true;
567 WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); 568 WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes, &proxy);
568 if (!context) 569 if (!context)
569 return scoped_ptr<cc::OutputSurface>(); 570 return scoped_ptr<cc::OutputSurface>();
570 571
571 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 572 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
572 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { 573 if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) {
573 // In the absence of a software-based delegating renderer, use this 574 // In the absence of a software-based delegating renderer, use this
574 // stopgap adapter class to present the software renderer output using a 575 // stopgap adapter class to present the software renderer output using a
575 // 3d context. 576 // 3d context.
576 return scoped_ptr<cc::OutputSurface>( 577 return scoped_ptr<cc::OutputSurface>(
577 new CompositorOutputSurface(routing_id(), NULL, 578 new CompositorOutputSurface(routing_id(), NULL, NULL,
578 new CompositorSoftwareOutputDeviceGLAdapter(context))); 579 new CompositorSoftwareOutputDeviceGLAdapter(context)));
579 } else { 580 } else {
580 bool composite_to_mailbox = 581 bool composite_to_mailbox =
581 command_line.HasSwitch(cc::switches::kCompositeToMailbox); 582 command_line.HasSwitch(cc::switches::kCompositeToMailbox);
582 DCHECK(!composite_to_mailbox || command_line.HasSwitch( 583 DCHECK(!composite_to_mailbox || command_line.HasSwitch(
583 cc::switches::kEnableCompositorFrameMessage)); 584 cc::switches::kEnableCompositorFrameMessage));
584 // No swap throttling yet when compositing on the main thread. 585 // No swap throttling yet when compositing on the main thread.
585 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); 586 DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_);
586 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? 587 return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ?
587 new MailboxOutputSurface(routing_id(), context, NULL) : 588 new MailboxOutputSurface(routing_id(), context, proxy, NULL) :
588 new CompositorOutputSurface(routing_id(), context, NULL)); 589 new CompositorOutputSurface(routing_id(), context, proxy, NULL));
589 } 590 }
590 } 591 }
591 592
592 void RenderWidget::OnViewContextSwapBuffersAborted() { 593 void RenderWidget::OnViewContextSwapBuffersAborted() {
593 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted"); 594 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersAborted");
594 while (!updates_pending_swap_.empty()) { 595 while (!updates_pending_swap_.empty()) {
595 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front(); 596 ViewHostMsg_UpdateRect* msg = updates_pending_swap_.front();
596 updates_pending_swap_.pop_front(); 597 updates_pending_swap_.pop_front();
597 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate 598 // msg can be NULL if the swap doesn't correspond to an DoDeferredUpdate
598 // compositing pass, hence doesn't require an UpdateRect message. 599 // compositing pass, hence doesn't require an UpdateRect message.
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 bool RenderWidget::WillHandleGestureEvent( 2250 bool RenderWidget::WillHandleGestureEvent(
2250 const WebKit::WebGestureEvent& event) { 2251 const WebKit::WebGestureEvent& event) {
2251 return false; 2252 return false;
2252 } 2253 }
2253 2254
2254 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { 2255 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const {
2255 return true; 2256 return true;
2256 } 2257 }
2257 2258
2258 WebGraphicsContext3D* RenderWidget::CreateGraphicsContext3D( 2259 WebGraphicsContext3D* RenderWidget::CreateGraphicsContext3D(
2259 const WebGraphicsContext3D::Attributes& attributes) { 2260 const WebGraphicsContext3D::Attributes& attributes,
2261 CommandBufferProxyImpl** proxy) {
2260 if (!webwidget_) 2262 if (!webwidget_)
2261 return NULL; 2263 return NULL;
2262 // The WebGraphicsContext3DInProcessImpl code path is used for 2264 // The WebGraphicsContext3DInProcessImpl code path is used for
2263 // layout tests (though not through this code) as well as for 2265 // layout tests (though not through this code) as well as for
2264 // debugging and bringing up new ports. 2266 // debugging and bringing up new ports.
2265 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) { 2267 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessWebGL)) {
2266 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( 2268 return webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView(
2267 attributes, true); 2269 attributes, true);
2268 } else { 2270 } else {
2269 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( 2271 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
2270 new WebGraphicsContext3DCommandBufferImpl( 2272 new WebGraphicsContext3DCommandBufferImpl(
2271 surface_id(), 2273 surface_id(),
2272 GetURLForGraphicsContext3D(), 2274 GetURLForGraphicsContext3D(),
2273 RenderThreadImpl::current(), 2275 RenderThreadImpl::current(),
2274 weak_ptr_factory_.GetWeakPtr())); 2276 weak_ptr_factory_.GetWeakPtr()));
2275 2277
2276 if (!context->Initialize( 2278 if (!context->Initialize(
2277 attributes, 2279 attributes,
2278 false /* bind generates resources */, 2280 false /* bind generates resources */,
2279 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E)) 2281 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ E))
2280 return NULL; 2282 return NULL;
2283 *proxy = context->GetCommandBufferProxy();
2281 return context.release(); 2284 return context.release();
2282 } 2285 }
2283 } 2286 }
2284 2287
2285 } // namespace content 2288 } // namespace content
OLDNEW
« content/renderer/gpu/mailbox_output_surface.cc ('K') | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698