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

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

Issue 2718523002: FrameGenerator: Don't issue BeginFrames if we have nothing to draw (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/containers/adapters.h" 10 #include "base/containers/adapters.h"
(...skipping 25 matching lines...) Expand all
36 widget, std::move(sink_request), binding_.CreateInterfacePtrAndBind(), 36 widget, std::move(sink_request), binding_.CreateInterfacePtrAndBind(),
37 std::move(display_request)); 37 std::move(display_request));
38 } 38 }
39 39
40 FrameGenerator::~FrameGenerator() = default; 40 FrameGenerator::~FrameGenerator() = default;
41 41
42 void FrameGenerator::SetDeviceScaleFactor(float device_scale_factor) { 42 void FrameGenerator::SetDeviceScaleFactor(float device_scale_factor) {
43 if (device_scale_factor_ == device_scale_factor) 43 if (device_scale_factor_ == device_scale_factor)
44 return; 44 return;
45 device_scale_factor_ = device_scale_factor; 45 device_scale_factor_ = device_scale_factor;
46 compositor_frame_sink_->SetNeedsBeginFrame(true); 46 if (window_manager_surface_info_.id().is_valid())
47 compositor_frame_sink_->SetNeedsBeginFrame(true);
47 } 48 }
48 49
49 void FrameGenerator::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { 50 void FrameGenerator::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) {
50 DCHECK(surface_info.id().is_valid()); 51 DCHECK(surface_info.id().is_valid());
51 52
52 // Only handle embedded surfaces changing here. The display root surface 53 // Only handle embedded surfaces changing here. The display root surface
53 // changing is handled immediately after the CompositorFrame is submitted. 54 // changing is handled immediately after the CompositorFrame is submitted.
54 if (surface_info != window_manager_surface_info_) { 55 if (surface_info != window_manager_surface_info_) {
55 window_manager_surface_info_ = surface_info; 56 window_manager_surface_info_ = surface_info;
56 compositor_frame_sink_->SetNeedsBeginFrame(true); 57 compositor_frame_sink_->SetNeedsBeginFrame(true);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); 168 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
168 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */, 169 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */,
169 bounds_at_origin /* visible_rect */, true /* needs_blending*/, 170 bounds_at_origin /* visible_rect */, true /* needs_blending*/,
170 window_manager_surface_info_.id(), 171 window_manager_surface_info_.id(),
171 cc::SurfaceDrawQuadType::PRIMARY, nullptr); 172 cc::SurfaceDrawQuadType::PRIMARY, nullptr);
172 } 173 }
173 174
174 } // namespace ws 175 } // namespace ws
175 176
176 } // namespace ui 177 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698