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

Side by Side Diff: cc/test/test_compositor_frame_sink.cc

Issue 2848223003: Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Fixed Android 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 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 "cc/test/test_compositor_frame_sink.h" 5 #include "cc/test/test_compositor_frame_sink.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 void TestCompositorFrameSink::SetLocalSurfaceId( 124 void TestCompositorFrameSink::SetLocalSurfaceId(
125 const LocalSurfaceId& local_surface_id) { 125 const LocalSurfaceId& local_surface_id) {
126 test_client_->DisplayReceivedLocalSurfaceId(local_surface_id); 126 test_client_->DisplayReceivedLocalSurfaceId(local_surface_id);
127 } 127 }
128 128
129 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 129 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
130 test_client_->DisplayReceivedCompositorFrame(frame); 130 test_client_->DisplayReceivedCompositorFrame(frame);
131 131
132 if (!delegated_local_surface_id_.is_valid()) { 132 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
133 delegated_local_surface_id_ = local_surface_id_allocator_->GenerateId(); 133 float device_scale_factor = frame.metadata.device_scale_factor;
134 if (!local_surface_id_.is_valid() || frame_size != display_size_ ||
135 device_scale_factor != device_scale_factor_) {
136 local_surface_id_ = local_surface_id_allocator_->GenerateId();
137 display_->SetLocalSurfaceId(local_surface_id_, device_scale_factor);
138 display_->Resize(frame_size);
139 display_size_ = frame_size;
140 device_scale_factor_ = device_scale_factor;
134 } 141 }
135 display_->SetLocalSurfaceId(delegated_local_surface_id_,
136 frame.metadata.device_scale_factor);
137 142
138 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 143 DCHECK(support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)));
danakj 2017/05/19 19:00:59 here's another
139 display_->Resize(frame_size);
140
141 support_->SubmitCompositorFrame(delegated_local_surface_id_,
142 std::move(frame));
143 144
144 for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_) { 145 for (std::unique_ptr<CopyOutputRequest>& copy_request : copy_requests_) {
145 support_->RequestCopyOfSurface(std::move(copy_request)); 146 support_->RequestCopyOfSurface(std::move(copy_request));
146 } 147 }
147 copy_requests_.clear(); 148 copy_requests_.clear();
148 149
149 if (!display_->has_scheduler()) { 150 if (!display_->has_scheduler()) {
150 display_->DrawAndSwap(); 151 display_->DrawAndSwap();
151 // Post this to get a new stack frame so that we exit this function before 152 // Post this to get a new stack frame so that we exit this function before
152 // calling the client to tell it that it is done. 153 // calling the client to tell it that it is done.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 support_->SetNeedsBeginFrame(needs_begin_frames); 199 support_->SetNeedsBeginFrame(needs_begin_frames);
199 } 200 }
200 201
201 void TestCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) {} 202 void TestCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) {}
202 203
203 void TestCompositorFrameSink::SendCompositorFrameAckToClient() { 204 void TestCompositorFrameSink::SendCompositorFrameAckToClient() {
204 client_->DidReceiveCompositorFrameAck(); 205 client_->DidReceiveCompositorFrameAck();
205 } 206 }
206 207
207 } // namespace cc 208 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698