Index: services/ui/ws/frame_generator.cc |
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc |
index 99c87813f5dced11dc6727a83c2c717689067eea..3d4466620e714a58fa4e8c0cdab42252ba3473aa 100644 |
--- a/services/ui/ws/frame_generator.cc |
+++ b/services/ui/ws/frame_generator.cc |
@@ -73,13 +73,21 @@ void FrameGenerator::Draw() { |
return; |
// TODO(fsamuel): We should add a trace for generating a top level frame. |
+ bool old_contains_video = may_contain_video_; |
cc::CompositorFrame frame(GenerateCompositorFrame()); |
+ if (old_contains_video != may_contain_video_) { |
+ // TODO(sad): Schedule notifying observers. |
+ } |
frame_pending_ = true; |
if (display_compositor_) { |
display_compositor_->SubmitCompositorFrame( |
std::move(frame), |
base::Bind(&FrameGenerator::DidDraw, weak_factory_.GetWeakPtr())); |
} |
+ if (may_contain_video_) { |
+ // TODO(sad): Start a timer to reset the bit if no new frame with video |
+ // is submitted 'soon'. |
+ } |
dirty_rect_ = gfx::Rect(); |
} |
@@ -99,6 +107,7 @@ cc::CompositorFrame FrameGenerator::GenerateCompositorFrame() { |
render_pass->SetNew(render_pass_id, output_rect, dirty_rect_, |
gfx::Transform()); |
+ may_contain_video_ = false; |
DrawWindowTree(render_pass.get(), delegate_->GetRootWindow(), gfx::Vector2d(), |
1.0f); |
@@ -126,6 +135,7 @@ cc::CompositorFrame FrameGenerator::GenerateCompositorFrame() { |
cc::CompositorFrame frame; |
frame.delegated_frame_data = std::move(frame_data); |
+ frame.metadata.may_contain_video = may_contain_video_; |
return frame; |
} |
@@ -179,6 +189,8 @@ void FrameGenerator::DrawWindowTree( |
gfx::Rect() /* opaque_rect */, |
bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
default_surface->id()); |
+ if (default_surface->may_contain_video()) |
+ may_contain_video_ = true; |
} |
if (underlay_surface) { |
const gfx::Rect underlay_absolute_bounds = |
@@ -201,6 +213,7 @@ void FrameGenerator::DrawWindowTree( |
gfx::Rect() /* opaque_rect */, |
bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
underlay_surface->id()); |
+ DCHECK(!underlay_surface->may_contain_video()); |
} |
} |