Chromium Code Reviews| Index: cc/surfaces/surface.cc |
| diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc |
| index 2ceae59329081c2295c5aadac3d04fb171d0742e..14846ec7c14e60e1c7dac5e500500eefc9b0d3e9 100644 |
| --- a/cc/surfaces/surface.cc |
| +++ b/cc/surfaces/surface.cc |
| @@ -23,9 +23,9 @@ namespace cc { |
| // completely damaged the first time they're drawn from. |
| static const int kFrameIndexStart = 2; |
| -Surface::Surface(const SurfaceId& id, base::WeakPtr<SurfaceFactory> factory) |
| - : surface_id_(id), |
| - previous_frame_surface_id_(id), |
| +Surface::Surface(const SurfaceInfo& info, base::WeakPtr<SurfaceFactory> factory) |
| + : surface_info_(info), |
| + previous_frame_surface_id_(info.id()), |
| factory_(factory), |
| frame_index_(kFrameIndexStart), |
| destroyed_(false) {} |
| @@ -53,6 +53,16 @@ void Surface::SetPreviousFrameSurface(Surface* surface) { |
| void Surface::QueueFrame(CompositorFrame frame, |
| const DrawCallback& callback, |
| const WillDrawCallback& will_draw_callback) { |
| + if (!frame.render_pass_list.empty()) { |
|
Fady Samuel
2017/05/07 18:16:51
Not necessary any more right?
Saman Sami
2017/05/08 20:40:32
Done.
|
| + 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()) { |
|
Fady Samuel
2017/05/01 20:36:54
Return resources and call the callback too.
Fady Samuel
2017/05/07 18:16:51
I'd love to move this test into a common place bec
Saman Sami
2017/05/08 20:40:32
That'll be nice, yes.
Saman Sami
2017/05/16 18:55:46
Actually, I'm not sure how much that will help. I
|
| + DLOG(ERROR) << "Frame size doesn't match surface size."; |
| + return; |
| + } |
| + } |
| + |
| TakeLatencyInfoFromPendingFrame(&frame.metadata.latency_info); |
| base::Optional<FrameData> previous_pending_frame_data = |
| @@ -287,7 +297,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); |
| } |