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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 const gfx::Rect& viewport, | 86 const gfx::Rect& viewport, |
| 87 bool resourceless_software_draw) {} | 87 bool resourceless_software_draw) {} |
| 88 | 88 |
| 89 void FrameGenerator::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) {} | 89 void FrameGenerator::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) {} |
| 90 | 90 |
| 91 void FrameGenerator::SetExternalTilePriorityConstraints( | 91 void FrameGenerator::SetExternalTilePriorityConstraints( |
| 92 const gfx::Rect& viewport_rect, | 92 const gfx::Rect& viewport_rect, |
| 93 const gfx::Transform& transform) {} | 93 const gfx::Transform& transform) {} |
| 94 | 94 |
| 95 void FrameGenerator::OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) { | 95 void FrameGenerator::OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) { |
| 96 if (!root_window_->visible()) | 96 if (!root_window_->visible() || |
| 97 begin_frame_args.type == cc::BeginFrameArgs::MISSED) { | |
| 97 return; | 98 return; |
| 99 } | |
| 98 | 100 |
| 99 // TODO(fsamuel): We should add a trace for generating a top level frame. | 101 // TODO(fsamuel): We should add a trace for generating a top level frame. |
| 100 cc::CompositorFrame frame(GenerateCompositorFrame(root_window_->bounds())); | 102 cc::CompositorFrame frame(GenerateCompositorFrame(root_window_->bounds())); |
| 101 | 103 |
| 102 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); | 104 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); |
| 103 SetNeedsBeginFrame(false); | 105 SetNeedsBeginFrame(false); |
| 104 last_begin_frame_args_ = begin_frame_args; | 106 last_begin_frame_args_ = begin_frame_args; |
| 105 } | 107 } |
| 106 | 108 |
| 107 const cc::BeginFrameArgs& FrameGenerator::LastUsedBeginFrameArgs() const { | 109 const cc::BeginFrameArgs& FrameGenerator::LastUsedBeginFrameArgs() const { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 182 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
| 181 window_manager_surface_info_.id(), | 183 window_manager_surface_info_.id(), |
| 182 cc::SurfaceDrawQuadType::PRIMARY, nullptr); | 184 cc::SurfaceDrawQuadType::PRIMARY, nullptr); |
| 183 } | 185 } |
| 184 | 186 |
| 185 void FrameGenerator::SetNeedsBeginFrame(bool needs_begin_frame) { | 187 void FrameGenerator::SetNeedsBeginFrame(bool needs_begin_frame) { |
| 186 if (needs_begin_frame == observing_begin_frames_) | 188 if (needs_begin_frame == observing_begin_frames_) |
| 187 return; | 189 return; |
| 188 | 190 |
| 189 if (needs_begin_frame) { | 191 if (needs_begin_frame) { |
| 192 observing_begin_frames_ = true; | |
|
Fady Samuel
2017/03/17 14:06:40
So I was looking at compositor_frame_sink_support.
Alex Z.
2017/03/17 14:43:00
Done.
| |
| 190 begin_frame_source_->AddObserver(this); | 193 begin_frame_source_->AddObserver(this); |
| 191 observing_begin_frames_ = true; | |
| 192 return; | 194 return; |
| 193 } | 195 } |
| 194 | 196 |
| 197 observing_begin_frames_ = false; | |
| 195 begin_frame_source_->RemoveObserver(this); | 198 begin_frame_source_->RemoveObserver(this); |
| 196 observing_begin_frames_ = false; | |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace ws | 201 } // namespace ws |
| 200 | 202 |
| 201 } // namespace ui | 203 } // namespace ui |
| OLD | NEW |