Chromium Code Reviews| Index: cc/surfaces/surface.cc |
| diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc |
| index 682f5217654f9077723f7ffdd75ad22b0a1bd7de..69e96bc3ea51ca9146229dbdd09bde28ab407d51 100644 |
| --- a/cc/surfaces/surface.cc |
| +++ b/cc/surfaces/surface.cc |
| @@ -24,10 +24,10 @@ namespace cc { |
| static const int kFrameIndexStart = 2; |
| Surface::Surface( |
| - const SurfaceId& id, |
| + const SurfaceInfo& surface_info, |
| base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support) |
| - : surface_id_(id), |
| - previous_frame_surface_id_(id), |
| + : surface_info_(surface_info), |
| + previous_frame_surface_id_(surface_info.id()), |
| compositor_frame_sink_support_(std::move(compositor_frame_sink_support)), |
| surface_manager_(compositor_frame_sink_support_->surface_manager()), |
| frame_index_(kFrameIndexStart), |
| @@ -58,6 +58,17 @@ void Surface::Close() { |
| void Surface::QueueFrame(CompositorFrame frame, |
| const base::Closure& callback, |
| const WillDrawCallback& will_draw_callback) { |
| + gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| + float device_scale_factor = frame.metadata.device_scale_factor; |
| + |
| + if (frame_size != surface_info_.size_in_pixels() || |
| + device_scale_factor != surface_info_.device_scale_factor()) { |
| + DLOG(ERROR) << "Frame size doesn't match surface size."; |
| + NOTREACHED(); |
| + callback.Run(); |
|
Fady Samuel
2017/05/08 20:21:19
Return resources too?
Saman Sami
2017/05/08 20:40:32
Yeah sure.
|
| + return; |
| + } |
| + |
| if (closed_) { |
| if (compositor_frame_sink_support_) { |
| ReturnedResourceArray resources; |
| @@ -306,7 +317,7 @@ void Surface::RunWillDrawCallback(const gfx::Rect& damage_rect) { |
| if (!active_frame_data_ || active_frame_data_->will_draw_callback.is_null()) |
| return; |
| - active_frame_data_->will_draw_callback.Run(surface_id_.local_surface_id(), |
| + active_frame_data_->will_draw_callback.Run(surface_id().local_surface_id(), |
| damage_rect); |
| } |