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

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Address comments Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_sink_client.h" 9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 CompositorFrameSink::DetachFromClient(); 93 CompositorFrameSink::DetachFromClient();
94 } 94 }
95 95
96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
97 DCHECK(frame.metadata.begin_frame_ack.has_damage); 97 DCHECK(frame.metadata.begin_frame_ack.has_damage);
98 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, 98 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber,
99 frame.metadata.begin_frame_ack.sequence_number); 99 frame.metadata.begin_frame_ack.sequence_number);
100 100
101 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 101 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
102 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { 102 if (!local_surface_id_.is_valid() || frame_size != last_swap_frame_size_ ||
103 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId(); 103 frame.metadata.device_scale_factor != device_scale_factor_) {
104 local_surface_id_ = local_surface_id_allocator_.GenerateId();
104 last_swap_frame_size_ = frame_size; 105 last_swap_frame_size_ = frame_size;
106 device_scale_factor_ = frame.metadata.device_scale_factor;
107 display_->SetLocalSurfaceId(local_surface_id_, device_scale_factor_);
105 } 108 }
106 display_->SetLocalSurfaceId(delegated_local_surface_id_,
107 frame.metadata.device_scale_factor);
108 109
109 support_->SubmitCompositorFrame(delegated_local_surface_id_, 110 bool result =
110 std::move(frame)); 111 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame));
112 DCHECK(result);
111 } 113 }
112 114
113 void DirectCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { 115 void DirectCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) {
114 DCHECK(!ack.has_damage); 116 DCHECK(!ack.has_damage);
115 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); 117 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
116 support_->DidNotProduceFrame(ack); 118 support_->DidNotProduceFrame(ack);
117 } 119 }
118 120
119 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() { 121 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() {
120 is_lost_ = true; 122 is_lost_ = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const LocalSurfaceId& local_surface_id, 154 const LocalSurfaceId& local_surface_id,
153 const gfx::Rect& damage_rect) { 155 const gfx::Rect& damage_rect) {
154 // TODO(staraz): Implement this. 156 // TODO(staraz): Implement this.
155 } 157 }
156 158
157 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { 159 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) {
158 support_->SetNeedsBeginFrame(needs_begin_frame); 160 support_->SetNeedsBeginFrame(needs_begin_frame);
159 } 161 }
160 162
161 } // namespace cc 163 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink.h ('k') | cc/surfaces/direct_compositor_frame_sink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698