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

Unified Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Notify CFSSClient when a frame is rejected 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
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..052cd4addc070e34465052b0bbbf8ac127148644 100644
--- a/cc/surfaces/compositor_frame_sink_support.cc
+++ b/cc/surfaces/compositor_frame_sink_support.cc
@@ -132,10 +132,27 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame(
if (!create_new_surface) {
surface = std::move(current_surface_);
} else {
- surface = CreateSurface(local_surface_id);
+ 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()) {
+ TRACE_EVENT_INSTANT0("cc", "Invalid SurfaceInfo",
+ TRACE_EVENT_SCOPE_THREAD);
+ if (current_surface_)
+ DestroyCurrentSurface();
+ ReturnedResourceArray resources;
+ TransferableResource::ReturnResources(frame.resource_list, &resources);
+ ReturnResources(resources);
+ DidReceiveCompositorFrameAck();
+ return;
+ }
+
+ surface = CreateSurface(surface_info);
}
- surface->QueueFrame(
+ bool result = surface->QueueFrame(
std::move(frame),
Fady Samuel 2017/05/18 20:51:32 Shouldn't we be returning resources here if this f
Saman Sami 2017/05/19 18:28:17 If the client misbehaves then not really.
base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck,
weak_factory_.GetWeakPtr()),
@@ -155,6 +172,9 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame(
// See https://crbug.com/703079.
if (begin_frame_source_)
begin_frame_source_->DidFinishFrame(this, ack);
+
+ if (!result)
+ client_->DidRejectCompositorFrame();
}
void CompositorFrameSinkSupport::UpdateSurfaceReferences(
@@ -332,11 +352,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);
- return surface;
+ return surface_manager_->CreateSurface(weak_factory_.GetWeakPtr(),
+ surface_info);
}
void CompositorFrameSinkSupport::DestroyCurrentSurface() {
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support.h ('k') | cc/surfaces/compositor_frame_sink_support_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698