Chromium Code Reviews| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 } | 122 } |
| 123 | 123 |
| 124 void FrameGenerator::DidReceiveCompositorFrameAck() {} | 124 void FrameGenerator::DidReceiveCompositorFrameAck() {} |
| 125 | 125 |
| 126 void FrameGenerator::OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) { | 126 void FrameGenerator::OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) { |
| 127 if (!root_window_->visible()) | 127 if (!root_window_->visible()) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 // TODO(fsamuel): We should add a trace for generating a top level frame. | 130 // TODO(fsamuel): We should add a trace for generating a top level frame. |
| 131 cc::CompositorFrame frame(GenerateCompositorFrame(root_window_->bounds())); | 131 cc::CompositorFrame frame(GenerateCompositorFrame(root_window_->bounds())); |
| 132 | |
| 132 if (compositor_frame_sink_) { | 133 if (compositor_frame_sink_) { |
| 133 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); | 134 gfx::Size frame_size; |
|
sadrul
2016/11/22 19:53:29
= last_submitted_frame_size_;
Fady Samuel
2016/11/22 20:17:26
Done.
| |
| 135 if (!frame.render_pass_list.empty()) | |
| 136 frame_size = frame.render_pass_list[0]->output_rect.size(); | |
| 137 if (!local_frame_id_.is_valid() || frame_size != last_submitted_frame_size_) | |
| 138 local_frame_id_ = id_allocator_.GenerateId(); | |
| 139 compositor_frame_sink_->SubmitCompositorFrame(local_frame_id_, | |
| 140 std::move(frame)); | |
| 141 last_submitted_frame_size_ = frame_size; | |
| 134 | 142 |
| 135 // Remove dead references after we submit a frame. This has to happen after | 143 // Remove dead references after we submit a frame. This has to happen after |
| 136 // the frame is submitted otherwise we could end up deleting a surface that | 144 // the frame is submitted otherwise we could end up deleting a surface that |
| 137 // is still embedded in the last frame. | 145 // is still embedded in the last frame. |
| 138 // TODO(kylechar): This should be synchronized with SubmitCompositorFrame(). | 146 // TODO(kylechar): This should be synchronized with SubmitCompositorFrame(). |
| 139 RemoveDeadSurfaceReferences(); | 147 RemoveDeadSurfaceReferences(); |
| 140 } | 148 } |
| 141 } | 149 } |
| 142 | 150 |
| 143 void FrameGenerator::ReclaimResources( | 151 void FrameGenerator::ReclaimResources( |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 cc::SurfaceId underlay_surface_id = | 382 cc::SurfaceId underlay_surface_id = |
| 375 window->compositor_frame_sink_manager()->GetLatestSurfaceId( | 383 window->compositor_frame_sink_manager()->GetLatestSurfaceId( |
| 376 mojom::CompositorFrameSinkType::UNDERLAY); | 384 mojom::CompositorFrameSinkType::UNDERLAY); |
| 377 if (underlay_surface_id.is_valid()) | 385 if (underlay_surface_id.is_valid()) |
| 378 RemoveFrameSinkReference(underlay_surface_id.frame_sink_id()); | 386 RemoveFrameSinkReference(underlay_surface_id.frame_sink_id()); |
| 379 } | 387 } |
| 380 | 388 |
| 381 } // namespace ws | 389 } // namespace ws |
| 382 | 390 |
| 383 } // namespace ui | 391 } // namespace ui |
| OLD | NEW |