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 "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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 test_client_ = nullptr; | 120 test_client_ = nullptr; |
121 CompositorFrameSink::DetachFromClient(); | 121 CompositorFrameSink::DetachFromClient(); |
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 DCHECK(frame.metadata.begin_frame_ack.has_damage); |
| 131 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, |
| 132 frame.metadata.begin_frame_ack.sequence_number); |
130 test_client_->DisplayReceivedCompositorFrame(frame); | 133 test_client_->DisplayReceivedCompositorFrame(frame); |
131 | 134 |
132 if (!delegated_local_surface_id_.is_valid()) { | 135 if (!delegated_local_surface_id_.is_valid()) { |
133 delegated_local_surface_id_ = local_surface_id_allocator_->GenerateId(); | 136 delegated_local_surface_id_ = local_surface_id_allocator_->GenerateId(); |
134 } | 137 } |
135 display_->SetLocalSurfaceId(delegated_local_surface_id_, | 138 display_->SetLocalSurfaceId(delegated_local_surface_id_, |
136 frame.metadata.device_scale_factor); | 139 frame.metadata.device_scale_factor); |
137 | 140 |
138 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); | 141 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
139 display_->Resize(frame_size); | 142 display_->Resize(frame_size); |
(...skipping 10 matching lines...) Expand all Loading... |
150 display_->DrawAndSwap(); | 153 display_->DrawAndSwap(); |
151 // Post this to get a new stack frame so that we exit this function before | 154 // 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. | 155 // calling the client to tell it that it is done. |
153 task_runner_->PostTask( | 156 task_runner_->PostTask( |
154 FROM_HERE, | 157 FROM_HERE, |
155 base::BindOnce(&TestCompositorFrameSink::SendCompositorFrameAckToClient, | 158 base::BindOnce(&TestCompositorFrameSink::SendCompositorFrameAckToClient, |
156 weak_ptr_factory_.GetWeakPtr())); | 159 weak_ptr_factory_.GetWeakPtr())); |
157 } | 160 } |
158 } | 161 } |
159 | 162 |
| 163 void TestCompositorFrameSink::BeginFrameDidNotProduceFrame( |
| 164 const BeginFrameAck& ack) { |
| 165 DCHECK(!ack.has_damage); |
| 166 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); |
| 167 support_->BeginFrameDidNotProduceFrame(ack); |
| 168 } |
| 169 |
160 void TestCompositorFrameSink::DidReceiveCompositorFrameAck( | 170 void TestCompositorFrameSink::DidReceiveCompositorFrameAck( |
161 const ReturnedResourceArray& resources) { | 171 const ReturnedResourceArray& resources) { |
162 ReclaimResources(resources); | 172 ReclaimResources(resources); |
163 // In synchronous mode, we manually send acks and this method should not be | 173 // In synchronous mode, we manually send acks and this method should not be |
164 // used. | 174 // used. |
165 if (!display_->has_scheduler()) | 175 if (!display_->has_scheduler()) |
166 return; | 176 return; |
167 client_->DidReceiveCompositorFrameAck(); | 177 client_->DidReceiveCompositorFrameAck(); |
168 } | 178 } |
169 | 179 |
(...skipping 28 matching lines...) Expand all Loading... |
198 support_->SetNeedsBeginFrame(needs_begin_frames); | 208 support_->SetNeedsBeginFrame(needs_begin_frames); |
199 } | 209 } |
200 | 210 |
201 void TestCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) {} | 211 void TestCompositorFrameSink::OnDidFinishFrame(const BeginFrameAck& ack) {} |
202 | 212 |
203 void TestCompositorFrameSink::SendCompositorFrameAckToClient() { | 213 void TestCompositorFrameSink::SendCompositorFrameAckToClient() { |
204 client_->DidReceiveCompositorFrameAck(); | 214 client_->DidReceiveCompositorFrameAck(); |
205 } | 215 } |
206 | 216 |
207 } // namespace cc | 217 } // namespace cc |
OLD | NEW |