Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Unified Diff: cc/surfaces/surface.cc

Issue 2757953002: DisplayCompositor should enforce invariant that frame size and device scale factor are fixed (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/surface.cc
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 3e16c6928a05e7f2d273785305693021a121491b..a4dcc60b4935e126a03415bec5105295aae09bc9 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -58,6 +58,22 @@ void Surface::SetPreviousFrameSurface(Surface* surface) {
void Surface::QueueFrame(CompositorFrame frame, const DrawCallback& callback) {
TakeLatencyInfoFromPendingFrame(&frame.metadata.latency_info);
+ if (!frame.render_pass_list.empty()) {
+ 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_)
+ surface_info_ = surface_info;
+
+ if (surface_info_ != surface_info) {
+ DCHECK(factory_);
+ factory_->OnBadFrameReceived();
+ return;
+ }
+ }
+
base::Optional<CompositorFrame> previous_pending_frame =
std::move(pending_frame_);
pending_frame_.reset();

Powered by Google App Engine
This is Rietveld 408576698