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

Unified Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: c Created 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/compositor_frame_sink_support.cc
diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc
index 0fdb6c6855755951a03bcee2ce4fda161f209986..6be5dc311ae8b27dd77814482bb2fbce3f2d87ae 100644
--- a/cc/surfaces/compositor_frame_sink_support.cc
+++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -125,6 +125,21 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame(
}
}
+ SurfaceId surface_id(frame_sink_id_, local_surface_id);
+ gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
+ float device_scale_factor = frame.metadata.device_scale_factor;
+ SurfaceInfo surface_info(surface_id, device_scale_factor, frame_size);
+ if (!surface_info.is_valid()) {
+ DLOG(ERROR) << "Cannot create a surface with invalid SurfaceInfo.";
danakj 2017/05/18 15:15:53 Can you make this a trace event instead so we can
Saman Sami 2017/05/18 20:44:37 Done.
+ if (current_surface_)
+ DestroyCurrentSurface();
+ ReturnedResourceArray resources;
+ TransferableResource::ReturnResources(frame.resource_list, &resources);
+ ReturnResources(resources);
+ DidReceiveCompositorFrameAck();
+ return;
+ }
+
std::unique_ptr<Surface> surface;
bool create_new_surface =
(!current_surface_ ||
@@ -132,7 +147,7 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame(
if (!create_new_surface) {
surface = std::move(current_surface_);
} else {
- surface = CreateSurface(local_surface_id);
+ surface = CreateSurface(surface_info);
}
surface->QueueFrame(
@@ -332,10 +347,10 @@ void CompositorFrameSinkSupport::UpdateNeedsBeginFramesInternal() {
}
std::unique_ptr<Surface> CompositorFrameSinkSupport::CreateSurface(
- const LocalSurfaceId& local_surface_id) {
+ const SurfaceInfo& surface_info) {
seen_first_frame_activation_ = false;
- std::unique_ptr<Surface> surface = surface_manager_->CreateSurface(
- weak_factory_.GetWeakPtr(), local_surface_id);
+ std::unique_ptr<Surface> surface =
danakj 2017/05/18 15:15:54 nit: just return here instead of using a variable
Saman Sami 2017/05/18 20:44:37 Done.
+ surface_manager_->CreateSurface(weak_factory_.GetWeakPtr(), surface_info);
return surface;
}

Powered by Google App Engine
This is Rietveld 408576698