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

Side by Side Diff: services/ui/ws/frame_generator.cc

Issue 2755573002: Add FrameGenerator Unit Tests (Closed)
Patch Set: Removed TestCompositorFrameSink due to name conflict Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */, 181 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */,
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 observing_begin_frames_ = needs_begin_frame;
192 if (needs_begin_frame)
190 begin_frame_source_->AddObserver(this); 193 begin_frame_source_->AddObserver(this);
191 observing_begin_frames_ = true; 194 else
192 return; 195 begin_frame_source_->RemoveObserver(this);
193 }
194
195 begin_frame_source_->RemoveObserver(this);
196 observing_begin_frames_ = false;
197 } 196 }
198 197
199 } // namespace ws 198 } // namespace ws
200 199
201 } // namespace ui 200 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/display_client_compositor_frame_sink.h ('k') | services/ui/ws/frame_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698