Index: cc/surfaces/surface.cc |
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc |
index 00de0c24878222656afe6be81862306cb3d699d2..125d089c934b181a169c1ef7c69a3940e2265465 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,7 +58,18 @@ void Surface::Close() { |
void Surface::QueueFrame(CompositorFrame frame, |
const base::Closure& callback, |
const WillDrawCallback& will_draw_callback) { |
- if (closed_) { |
+ bool reject_frame = closed_; |
+ |
+ 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(FATAL) << "Rejected CompositorFrame that violates surface invariants."; |
Fady Samuel
2017/05/17 00:40:50
Is this necessary? Don't we already check this in
Saman Sami
2017/05/17 00:55:17
We don't. I guess you are confusing it with the ch
|
+ reject_frame = true; |
+ } |
+ |
+ if (reject_frame) { |
if (compositor_frame_sink_support_) { |
ReturnedResourceArray resources; |
TransferableResource::ReturnResources(frame.resource_list, &resources); |
@@ -307,7 +318,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); |
} |