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

Unified Diff: cc/surfaces/surface_factory.cc

Issue 2811813004: Surface Synchronization: Distinguish between dependencies and references (Closed)
Patch Set: Addressed Vlad's comments 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/surface_factory.cc
diff --git a/cc/surfaces/surface_factory.cc b/cc/surfaces/surface_factory.cc
index 880cb8c828a675fe85cd426bfb9caa05355e6cbc..f6a6e0ec0f26f0f0ff75070cc33f9038a1073069 100644
--- a/cc/surfaces/surface_factory.cc
+++ b/cc/surfaces/surface_factory.cc
@@ -105,32 +105,26 @@ void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) {
holder_.UnrefResources(resources);
}
-void SurfaceFactory::OnReferencedSurfacesChanged(
- Surface* surface,
- const std::vector<SurfaceId>* active_referenced_surfaces,
- const std::vector<SurfaceId>* pending_referenced_surfaces) {
- client_->ReferencedSurfacesChanged(surface->surface_id().local_surface_id(),
- active_referenced_surfaces,
- pending_referenced_surfaces);
-}
-
void SurfaceFactory::OnSurfaceActivated(Surface* surface) {
DCHECK(surface->HasActiveFrame());
- if (seen_first_frame_activation_)
- return;
-
- seen_first_frame_activation_ = true;
-
- const CompositorFrame& frame = surface->GetActiveFrame();
- // CompositorFrames might not be populated with a RenderPass in unit tests.
- gfx::Size frame_size;
- if (!frame.render_pass_list.empty())
- frame_size = frame.render_pass_list.back()->output_rect.size();
-
- // SurfaceCreated only applies for the first Surface activation. Thus,
- // SurfaceFactory stops observing new activations after the first one.
- manager_->SurfaceCreated(SurfaceInfo(
- surface->surface_id(), frame.metadata.device_scale_factor, frame_size));
+ if (!seen_first_frame_activation_) {
+ seen_first_frame_activation_ = true;
+
+ const CompositorFrame& frame = surface->GetActiveFrame();
+ // CompositorFrames might not be populated with a RenderPass in unit tests.
+ gfx::Size frame_size;
+ if (!frame.render_pass_list.empty())
+ frame_size = frame.render_pass_list.back()->output_rect.size();
+
+ // SurfaceCreated only applies for the first Surface activation. Thus,
+ // SurfaceFactory stops observing new activations after the first one.
+ manager_->SurfaceCreated(SurfaceInfo(
+ surface->surface_id(), frame.metadata.device_scale_factor, frame_size));
+ }
+ // Fire SurfaceCreated first so that a temporary reference is added before it
+ // is potentially transformed into a real reference by the client.
+ client_->ReferencedSurfacesChanged(surface->surface_id().local_surface_id(),
+ surface->active_referenced_surfaces());
}
void SurfaceFactory::OnSurfaceDependenciesChanged(

Powered by Google App Engine
This is Rietveld 408576698