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."; |
danakj
2017/05/18 15:15:54
can this be a trace event also?
Saman Sami
2017/05/18 20:44:37
Done.
|
+ reject_frame = true; |
danakj
2017/05/17 20:49:36
How will this happen in practice? Why isn't this j
Saman Sami
2017/05/17 20:52:08
If the client misbehaves, for example.
danakj
2017/05/17 21:03:28
Can't we reject that at the IPC boundary instead o
Saman Sami
2017/05/17 21:22:50
We don't know the details of the surface at IPC bo
danakj
2017/05/17 21:25:28
I guess I am asking how far out we can push it the
Saman Sami
2017/05/17 21:39:26
I guess we can do the verification in CFSS but I'm
Fady Samuel
2017/05/18 11:45:25
+1 There isn't a whole lot up the stack in some ca
|
+ } |
+ |
+ 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); |
} |