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

Side by Side Diff: components/exo/surface.cc

Issue 2786643002: [exo]CompositorFrameSinkHolder calls WillDraw in DidReceiveCompositorFrameAck (Closed)
Patch Set: Move Presentation Callbacks Before UpdateSurface Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 457
458 UpdateResource(true); 458 UpdateResource(true);
459 } 459 }
460 460
461 cc::LocalSurfaceId old_local_surface_id = local_surface_id_; 461 cc::LocalSurfaceId old_local_surface_id = local_surface_id_;
462 if (needs_commit_to_new_surface_ || !local_surface_id_.is_valid()) { 462 if (needs_commit_to_new_surface_ || !local_surface_id_.is_valid()) {
463 needs_commit_to_new_surface_ = false; 463 needs_commit_to_new_surface_ = false;
464 local_surface_id_ = id_allocator_.GenerateId(); 464 local_surface_id_ = id_allocator_.GenerateId();
465 } 465 }
466 466
467 // Move pending frame callbacks to the end of frame_callbacks_.
468 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_);
469
470 // Move pending presentation callbacks to the end of presentation_callbacks_.
471 presentation_callbacks_.splice(presentation_callbacks_.end(),
472 pending_presentation_callbacks_);
473
467 UpdateSurface(false); 474 UpdateSurface(false);
468 475
469 if (old_local_surface_id != local_surface_id_) { 476 if (old_local_surface_id != local_surface_id_) {
470 float contents_surface_to_layer_scale = 1.0; 477 float contents_surface_to_layer_scale = 1.0;
471 // The bounds must be updated before switching to the new surface, because 478 // The bounds must be updated before switching to the new surface, because
472 // the layer may be mirrored, in which case a surface change causes the 479 // the layer may be mirrored, in which case a surface change causes the
473 // mirror layer to update its surface using the latest bounds. 480 // mirror layer to update its surface using the latest bounds.
474 window_->layer()->SetBounds( 481 window_->layer()->SetBounds(
475 gfx::Rect(window_->layer()->bounds().origin(), content_size_)); 482 gfx::Rect(window_->layer()->bounds().origin(), content_size_));
476 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_); 483 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_);
477 window_->layer()->SetShowPrimarySurface( 484 window_->layer()->SetShowPrimarySurface(
478 cc::SurfaceInfo(surface_id, contents_surface_to_layer_scale, 485 cc::SurfaceInfo(surface_id, contents_surface_to_layer_scale,
479 content_size_), 486 content_size_),
480 surface_reference_factory_); 487 surface_reference_factory_);
481 window_->layer()->SetFillsBoundsOpaquely( 488 window_->layer()->SetFillsBoundsOpaquely(
482 !current_resource_has_alpha_ || 489 !current_resource_has_alpha_ ||
483 state_.blend_mode == SkBlendMode::kSrc || 490 state_.blend_mode == SkBlendMode::kSrc ||
484 state_.opaque_region.contains( 491 state_.opaque_region.contains(
485 gfx::RectToSkIRect(gfx::Rect(content_size_)))); 492 gfx::RectToSkIRect(gfx::Rect(content_size_))));
486 } 493 }
487 494
488 // Reset damage. 495 // Reset damage.
489 pending_damage_.setEmpty(); 496 pending_damage_.setEmpty();
490 497
491 DCHECK(!current_resource_.id || 498 DCHECK(!current_resource_.id ||
492 compositor_frame_sink_holder_->HasReleaseCallbackForResource( 499 compositor_frame_sink_holder_->HasReleaseCallbackForResource(
493 current_resource_.id)); 500 current_resource_.id));
494 501
495 // Move pending frame callbacks to the end of frame_callbacks_.
496 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_);
497
498 // Move pending presentation callbacks to the end of presentation_callbacks_.
499 presentation_callbacks_.splice(presentation_callbacks_.end(),
500 pending_presentation_callbacks_);
501
502 // Synchronize window hierarchy. This will position and update the stacking 502 // Synchronize window hierarchy. This will position and update the stacking
503 // order of all sub-surfaces after committing all pending state of sub-surface 503 // order of all sub-surfaces after committing all pending state of sub-surface
504 // descendants. 504 // descendants.
505 aura::Window* stacking_target = nullptr; 505 aura::Window* stacking_target = nullptr;
506 for (auto& sub_surface_entry : pending_sub_surfaces_) { 506 for (auto& sub_surface_entry : pending_sub_surfaces_) {
507 Surface* sub_surface = sub_surface_entry.first; 507 Surface* sub_surface = sub_surface_entry.first;
508 508
509 // Synchronsouly commit all pending state of the sub-surface and its 509 // Synchronsouly commit all pending state of the sub-surface and its
510 // decendents. 510 // decendents.
511 if (sub_surface->needs_commit_surface_hierarchy()) 511 if (sub_surface->needs_commit_surface_hierarchy())
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); 876 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>();
877 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); 877 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false);
878 } 878 }
879 879
880 frame.render_pass_list.push_back(std::move(render_pass)); 880 frame.render_pass_list.push_back(std::move(render_pass));
881 compositor_frame_sink_holder_->GetCompositorFrameSink() 881 compositor_frame_sink_holder_->GetCompositorFrameSink()
882 ->SubmitCompositorFrame(local_surface_id_, std::move(frame)); 882 ->SubmitCompositorFrame(local_surface_id_, std::move(frame));
883 } 883 }
884 884
885 } // namespace exo 885 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698