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() { |