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

Unified Diff: services/ui/ws/frame_generator.cc

Issue 2140783002: services/ui: Detect when a video is playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « services/ui/ws/frame_generator.h ('k') | services/ui/ws/server_window_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/frame_generator.cc
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc
index 81a29c86ed22f6edaa367f59bbc197b52f26304d..0aa3f8c1c2f4a104b9f6cf28c2c11a3badb09544 100644
--- a/services/ui/ws/frame_generator.cc
+++ b/services/ui/ws/frame_generator.cc
@@ -73,7 +73,15 @@ 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());
sky 2016/07/27 21:19:34 It's mildly confusing that GenerateCompositorFrame
sadrul 2016/07/28 00:48:05 Done (also made GenerateCompositorFrame() and Draw
+ if (old_contains_video != may_contain_video_) {
+ // TODO(sad): Schedule notifying observers.
+ if (may_contain_video_) {
+ // TODO(sad): Start a timer to reset the bit if no new frame with video
+ // is submitted 'soon'.
+ }
+ }
frame_pending_ = true;
if (display_compositor_) {
display_compositor_->SubmitCompositorFrame(
@@ -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());
}
}
« no previous file with comments | « services/ui/ws/frame_generator.h ('k') | services/ui/ws/server_window_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698