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

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..767713bbe78bce6a0239093f8463c0abb9c66491 100644
--- a/cc/surfaces/compositor_frame_sink_support.cc
+++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -125,6 +125,23 @@ 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.";
+ if (current_surface_) {
+ current_surface_->RunDrawCallback();
Fady Samuel 2017/05/17 00:40:50 Could you please add a comment why we need to do t
Saman Sami 2017/05/17 00:55:17 It's already called in the destructor. My bad.
+ 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 +149,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 +349,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 =
+ surface_manager_->CreateSurface(weak_factory_.GetWeakPtr(), surface_info);
return surface;
}

Powered by Google App Engine
This is Rietveld 408576698