OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/ui/ws/frame_generator.h" | 5 #include "services/ui/ws/frame_generator.h" |
6 | 6 |
7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // TODO(rjkroege): Use vblank to kick off Draw. | 75 // TODO(rjkroege): Use vblank to kick off Draw. |
76 draw_timer_.Start( | 76 draw_timer_.Start( |
77 FROM_HERE, base::TimeDelta(), | 77 FROM_HERE, base::TimeDelta(), |
78 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); | 78 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); |
79 } | 79 } |
80 | 80 |
81 void FrameGenerator::Draw() { | 81 void FrameGenerator::Draw() { |
82 if (!delegate_->GetRootWindow()->visible()) | 82 if (!delegate_->GetRootWindow()->visible()) |
83 return; | 83 return; |
84 | 84 |
85 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); | 85 const gfx::Rect output_rect(delegate_->GetViewportMetrics().pixel_size); |
86 const gfx::Rect output_rect(metrics.pixel_size); | |
87 dirty_rect_.Intersect(output_rect); | 86 dirty_rect_.Intersect(output_rect); |
88 // TODO(fsamuel): We should add a trace for generating a top level frame. | 87 // TODO(fsamuel): We should add a trace for generating a top level frame. |
89 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); | 88 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); |
90 if (frame.metadata.may_contain_video != may_contain_video_) { | 89 if (frame.metadata.may_contain_video != may_contain_video_) { |
91 may_contain_video_ = frame.metadata.may_contain_video; | 90 may_contain_video_ = frame.metadata.may_contain_video; |
92 // TODO(sad): Schedule notifying observers. | 91 // TODO(sad): Schedule notifying observers. |
93 if (may_contain_video_) { | 92 if (may_contain_video_) { |
94 // TODO(sad): Start a timer to reset the bit if no new frame with video | 93 // TODO(sad): Start a timer to reset the bit if no new frame with video |
95 // is submitted 'soon'. | 94 // is submitted 'soon'. |
96 } | 95 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (default_surface) | 306 if (default_surface) |
308 ReleaseFrameSinkReference(default_surface->frame_sink_id()); | 307 ReleaseFrameSinkReference(default_surface->frame_sink_id()); |
309 ServerWindowSurface* underlay_surface = surface_manager->GetUnderlaySurface(); | 308 ServerWindowSurface* underlay_surface = surface_manager->GetUnderlaySurface(); |
310 if (underlay_surface) | 309 if (underlay_surface) |
311 ReleaseFrameSinkReference(underlay_surface->frame_sink_id()); | 310 ReleaseFrameSinkReference(underlay_surface->frame_sink_id()); |
312 } | 311 } |
313 | 312 |
314 } // namespace ws | 313 } // namespace ws |
315 | 314 |
316 } // namespace ui | 315 } // namespace ui |
OLD | NEW |