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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 10663003: Merge the IPCs used for GPU process synchronization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 5 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/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( 545 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped(
546 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, 546 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel,
547 int gpu_host_id) { 547 int gpu_host_id) {
548 current_surface_ = params_in_pixel.surface_handle; 548 current_surface_ = params_in_pixel.surface_handle;
549 UpdateExternalTexture(); 549 UpdateExternalTexture();
550 550
551 ui::Compositor* compositor = GetCompositor(); 551 ui::Compositor* compositor = GetCompositor();
552 if (!compositor) { 552 if (!compositor) {
553 // We have no compositor, so we have no way to display the surface. 553 // We have no compositor, so we have no way to display the surface.
554 // Must still send the ACK. 554 // Must still send the ACK.
555 RenderWidgetHostImpl::AcknowledgeSwapBuffers(params_in_pixel.route_id, 555 RenderWidgetHostImpl::AcknowledgeBufferPresent(params_in_pixel.route_id,
556 gpu_host_id); 556 gpu_host_id);
557 } else { 557 } else {
558 gfx::Size surface_size_in_pixel = 558 gfx::Size surface_size_in_pixel =
559 image_transport_clients_[params_in_pixel.surface_handle]->size(); 559 image_transport_clients_[params_in_pixel.surface_handle]->size();
560 gfx::Size surface_size = content::ConvertSizeToDIP(this, 560 gfx::Size surface_size = content::ConvertSizeToDIP(this,
561 surface_size_in_pixel); 561 surface_size_in_pixel);
562 window_->SchedulePaintInRect(gfx::Rect(surface_size)); 562 window_->SchedulePaintInRect(gfx::Rect(surface_size));
563 563
564 if (!resize_locks_.empty() && !compositor->DrawPending()) { 564 if (!resize_locks_.empty() && !compositor->DrawPending()) {
565 // If we are waiting for the resize, fast-track the ACK. 565 // If we are waiting for the resize, fast-track the ACK.
566 // However only do so if we're not between the Draw() and the 566 // However only do so if we're not between the Draw() and the
567 // OnCompositingEnded(), because out-of-order execution in the GPU process 567 // OnCompositingEnded(), because out-of-order execution in the GPU process
568 // might corrupt the "front buffer" for the currently issued frame. 568 // might corrupt the "front buffer" for the currently issued frame.
569 RenderWidgetHostImpl::AcknowledgeSwapBuffers( 569 RenderWidgetHostImpl::AcknowledgeBufferPresent(
570 params_in_pixel.route_id, gpu_host_id); 570 params_in_pixel.route_id, gpu_host_id);
571 } else { 571 } else {
572 // Add sending an ACK to the list of things to do OnCompositingEnded 572 // Add sending an ACK to the list of things to do OnCompositingEnded
573 on_compositing_ended_callbacks_.push_back( 573 on_compositing_ended_callbacks_.push_back(
574 base::Bind(&RenderWidgetHostImpl::AcknowledgeSwapBuffers, 574 base::Bind(&RenderWidgetHostImpl::AcknowledgeBufferPresent,
575 params_in_pixel.route_id, gpu_host_id)); 575 params_in_pixel.route_id, gpu_host_id));
576 if (!compositor->HasObserver(this)) 576 if (!compositor->HasObserver(this))
577 compositor->AddObserver(this); 577 compositor->AddObserver(this);
578 } 578 }
579 } 579 }
580 } 580 }
581 581
582 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( 582 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer(
583 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, 583 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel,
584 int gpu_host_id) { 584 int gpu_host_id) {
585 current_surface_ = params_in_pixel.surface_handle; 585 current_surface_ = params_in_pixel.surface_handle;
586 UpdateExternalTexture(); 586 UpdateExternalTexture();
587 587
588 ui::Compositor* compositor = GetCompositor(); 588 ui::Compositor* compositor = GetCompositor();
589 if (!compositor) { 589 if (!compositor) {
590 // We have no compositor, so we have no way to display the surface 590 // We have no compositor, so we have no way to display the surface
591 // Must still send the ACK 591 // Must still send the ACK
592 RenderWidgetHostImpl::AcknowledgePostSubBuffer( 592 RenderWidgetHostImpl::AcknowledgeBufferPresent(
593 params_in_pixel.route_id, gpu_host_id); 593 params_in_pixel.route_id, gpu_host_id);
594 } else { 594 } else {
595 gfx::Size surface_size_in_pixel = 595 gfx::Size surface_size_in_pixel =
596 image_transport_clients_[params_in_pixel.surface_handle]->size(); 596 image_transport_clients_[params_in_pixel.surface_handle]->size();
597 597
598 // Co-ordinates come in OpenGL co-ordinate space. 598 // Co-ordinates come in OpenGL co-ordinate space.
599 // We need to convert to layer space. 599 // We need to convert to layer space.
600 gfx::Rect rect_to_paint = content::ConvertRectToDIP(this, gfx::Rect( 600 gfx::Rect rect_to_paint = content::ConvertRectToDIP(this, gfx::Rect(
601 params_in_pixel.x, 601 params_in_pixel.x,
602 surface_size_in_pixel.height() - params_in_pixel.y - 602 surface_size_in_pixel.height() - params_in_pixel.y -
603 params_in_pixel.height, 603 params_in_pixel.height,
604 params_in_pixel.width, 604 params_in_pixel.width,
605 params_in_pixel.height)); 605 params_in_pixel.height));
606 window_->SchedulePaintInRect(rect_to_paint); 606 window_->SchedulePaintInRect(rect_to_paint);
607 607
608 if (!resize_locks_.empty() && !compositor->DrawPending()) { 608 if (!resize_locks_.empty() && !compositor->DrawPending()) {
609 // If we are waiting for the resize, fast-track the ACK. 609 // If we are waiting for the resize, fast-track the ACK.
610 // However only do so if we're not between the Draw() and the 610 // However only do so if we're not between the Draw() and the
611 // OnCompositingEnded(), because out-of-order execution in the GPU process 611 // OnCompositingEnded(), because out-of-order execution in the GPU process
612 // might corrupt the "front buffer" for the currently issued frame. 612 // might corrupt the "front buffer" for the currently issued frame.
613 RenderWidgetHostImpl::AcknowledgePostSubBuffer( 613 RenderWidgetHostImpl::AcknowledgeBufferPresent(
614 params_in_pixel.route_id, gpu_host_id); 614 params_in_pixel.route_id, gpu_host_id);
615 } else { 615 } else {
616 // Add sending an ACK to the list of things to do OnCompositingEnded 616 // Add sending an ACK to the list of things to do OnCompositingEnded
617 on_compositing_ended_callbacks_.push_back( 617 on_compositing_ended_callbacks_.push_back(
618 base::Bind(&RenderWidgetHostImpl::AcknowledgePostSubBuffer, 618 base::Bind(&RenderWidgetHostImpl::AcknowledgeBufferPresent,
619 params_in_pixel.route_id, gpu_host_id)); 619 params_in_pixel.route_id, gpu_host_id));
620 if (!compositor->HasObserver(this)) 620 if (!compositor->HasObserver(this))
621 compositor->AddObserver(this); 621 compositor->AddObserver(this);
622 } 622 }
623 } 623 }
624 } 624 }
625 625
626 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() { 626 void RenderWidgetHostViewAura::AcceleratedSurfaceSuspend() {
627 } 627 }
628 628
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 1391 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
1392 RenderWidgetHost* widget) { 1392 RenderWidgetHost* widget) {
1393 return new RenderWidgetHostViewAura(widget); 1393 return new RenderWidgetHostViewAura(widget);
1394 } 1394 }
1395 1395
1396 // static 1396 // static
1397 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 1397 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
1398 WebKit::WebScreenInfo* results) { 1398 WebKit::WebScreenInfo* results) {
1399 GetScreenInfoForWindow(results, NULL); 1399 GetScreenInfoForWindow(results, NULL);
1400 } 1400 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/browser/renderer_host/render_widget_host_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698