174 {
175 TRACE_EVENT0(
"flutter",
"VulkanSurfaceProducer::SubmitSurfaces");
176
177
178 {
179 TRACE_EVENT0(
"flutter",
"GrDirectContext::flushAndSignalSemaphores");
181 }
182
183 if (!TransitionSurfacesToExternal(surfaces))
184 FML_LOG(
ERROR) <<
"TransitionSurfacesToExternal failed";
185
186
187 for (
auto&
surface : surfaces) {
188 SubmitSurface(std::move(
surface));
189 }
190
191
192 surface_pool_->AgeAndCollectOldBuffers();
193
194
195
196 constexpr auto kShouldShrinkThreshold = zx::msec(10 * 16.67);
197 async::PostDelayedTask(
198 async_get_default_dispatcher(),
199 [
self = weak_factory_.GetWeakPtr(), kShouldShrinkThreshold] {
200 if (!self) {
201 return;
202 }
203 auto time_since_last_produce =
204 async::Now(async_get_default_dispatcher()) -
205 self->last_produce_time_;
206 if (time_since_last_produce >= kShouldShrinkThreshold) {
207 self->surface_pool_->ShrinkToFit();
208 }
209 },
210 kShouldShrinkThreshold);
211}
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
#define TRACE_EVENT0(category_group, name)