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 "cc/output/begin_frame_args.h" | 10 #include "cc/output/begin_frame_args.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); | 110 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); |
111 bound_ = false; | 111 bound_ = false; |
112 } | 112 } |
113 display_ = nullptr; | 113 display_ = nullptr; |
114 surface_factory_ = nullptr; | 114 surface_factory_ = nullptr; |
115 surface_id_allocator_ = nullptr; | 115 surface_id_allocator_ = nullptr; |
116 surface_manager_ = nullptr; | 116 surface_manager_ = nullptr; |
117 CompositorFrameSink::DetachFromClient(); | 117 CompositorFrameSink::DetachFromClient(); |
118 } | 118 } |
119 | 119 |
120 void TestCompositorFrameSink::SwapBuffers(CompositorFrame frame) { | 120 void TestCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { |
121 if (test_client_) | 121 if (test_client_) |
122 test_client_->DisplayReceivedCompositorFrame(frame); | 122 test_client_->DisplayReceivedCompositorFrame(frame); |
123 | 123 |
124 if (delegated_local_frame_id_.is_null()) { | 124 if (delegated_local_frame_id_.is_null()) { |
125 delegated_local_frame_id_ = surface_id_allocator_->GenerateId(); | 125 delegated_local_frame_id_ = surface_id_allocator_->GenerateId(); |
126 surface_factory_->Create(delegated_local_frame_id_); | 126 surface_factory_->Create(delegated_local_frame_id_); |
127 } | 127 } |
128 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_), | 128 display_->SetSurfaceId(SurfaceId(frame_sink_id_, delegated_local_frame_id_), |
129 frame.metadata.device_scale_factor); | 129 frame.metadata.device_scale_factor); |
130 | 130 |
(...skipping 26 matching lines...) Expand all Loading... |
157 display_->DrawAndSwap(); | 157 display_->DrawAndSwap(); |
158 // Post this to get a new stack frame so that we exit this function before | 158 // Post this to get a new stack frame so that we exit this function before |
159 // calling the client to tell it that it is done. | 159 // calling the client to tell it that it is done. |
160 task_runner_->PostTask(FROM_HERE, | 160 task_runner_->PostTask(FROM_HERE, |
161 base::Bind(&TestCompositorFrameSink::DidDrawCallback, | 161 base::Bind(&TestCompositorFrameSink::DidDrawCallback, |
162 weak_ptr_factory_.GetWeakPtr())); | 162 weak_ptr_factory_.GetWeakPtr())); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 void TestCompositorFrameSink::DidDrawCallback() { | 166 void TestCompositorFrameSink::DidDrawCallback() { |
167 // This is the frame ack to unthrottle the next frame, not actually a notice | 167 // This is to unthrottle the next frame, not actually a notice that drawing is |
168 // that drawing is done. | 168 // done. |
169 client_->DidSwapBuffersComplete(); | 169 client_->DidReceiveCompositorFrameAck(); |
170 } | 170 } |
171 | 171 |
172 void TestCompositorFrameSink::ForceReclaimResources() { | 172 void TestCompositorFrameSink::ForceReclaimResources() { |
173 if (capabilities_.can_force_reclaim_resources && | 173 if (capabilities_.can_force_reclaim_resources && |
174 !delegated_local_frame_id_.is_null()) { | 174 !delegated_local_frame_id_.is_null()) { |
175 surface_factory_->SubmitCompositorFrame(delegated_local_frame_id_, | 175 surface_factory_->SubmitCompositorFrame(delegated_local_frame_id_, |
176 CompositorFrame(), | 176 CompositorFrame(), |
177 SurfaceFactory::DrawCallback()); | 177 SurfaceFactory::DrawCallback()); |
178 } | 178 } |
179 } | 179 } |
(...skipping 18 matching lines...) Expand all Loading... |
198 if (test_client_) | 198 if (test_client_) |
199 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); | 199 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); |
200 } | 200 } |
201 | 201 |
202 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { | 202 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { |
203 if (test_client_) | 203 if (test_client_) |
204 test_client_->DisplayDidDrawAndSwap(); | 204 test_client_->DisplayDidDrawAndSwap(); |
205 } | 205 } |
206 | 206 |
207 } // namespace cc | 207 } // namespace cc |
OLD | NEW |