| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // TODO(rjkroege): Use vblank to kick off Draw. | 81 // TODO(rjkroege): Use vblank to kick off Draw. |
| 82 draw_timer_.Start( | 82 draw_timer_.Start( |
| 83 FROM_HERE, base::TimeDelta(), | 83 FROM_HERE, base::TimeDelta(), |
| 84 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); | 84 base::Bind(&FrameGenerator::Draw, weak_factory_.GetWeakPtr())); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void FrameGenerator::Draw() { | 87 void FrameGenerator::Draw() { |
| 88 if (!delegate_->GetRootWindow()->visible()) | 88 if (!delegate_->GetRootWindow()->visible()) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 const ViewportMetrics& metrics = delegate_->GetViewportMetrics(); | 91 const gfx::Rect output_rect(delegate_->GetViewportMetrics().pixel_size); |
| 92 const gfx::Rect output_rect(metrics.pixel_size); | |
| 93 dirty_rect_.Intersect(output_rect); | 92 dirty_rect_.Intersect(output_rect); |
| 94 // TODO(fsamuel): We should add a trace for generating a top level frame. | 93 // TODO(fsamuel): We should add a trace for generating a top level frame. |
| 95 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); | 94 cc::CompositorFrame frame(GenerateCompositorFrame(output_rect)); |
| 96 if (frame.metadata.may_contain_video != may_contain_video_) { | 95 if (frame.metadata.may_contain_video != may_contain_video_) { |
| 97 may_contain_video_ = frame.metadata.may_contain_video; | 96 may_contain_video_ = frame.metadata.may_contain_video; |
| 98 // TODO(sad): Schedule notifying observers. | 97 // TODO(sad): Schedule notifying observers. |
| 99 if (may_contain_video_) { | 98 if (may_contain_video_) { |
| 100 // TODO(sad): Start a timer to reset the bit if no new frame with video | 99 // TODO(sad): Start a timer to reset the bit if no new frame with video |
| 101 // is submitted 'soon'. | 100 // is submitted 'soon'. |
| 102 } | 101 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 if (default_surface) | 312 if (default_surface) |
| 314 ReleaseFrameSinkReference(default_surface->frame_sink_id()); | 313 ReleaseFrameSinkReference(default_surface->frame_sink_id()); |
| 315 ServerWindowSurface* underlay_surface = surface_manager->GetUnderlaySurface(); | 314 ServerWindowSurface* underlay_surface = surface_manager->GetUnderlaySurface(); |
| 316 if (underlay_surface) | 315 if (underlay_surface) |
| 317 ReleaseFrameSinkReference(underlay_surface->frame_sink_id()); | 316 ReleaseFrameSinkReference(underlay_surface->frame_sink_id()); |
| 318 } | 317 } |
| 319 | 318 |
| 320 } // namespace ws | 319 } // namespace ws |
| 321 | 320 |
| 322 } // namespace ui | 321 } // namespace ui |
| OLD | NEW |