222 {
223 static size_t trace_counter = 1;
224 const size_t trace_id = trace_counter++;
225
228 }
229
231
232 const auto& task_runners = dart_state->GetTaskRunners();
233
234 if (state_->frameCount_ == 0) {
235 std::string decode_error("Could not provide any frame.");
238 [trace_id, decode_error = std::move(decode_error),
239 callback = std::make_unique<tonic::DartPersistentValue>(
242 trace_id);
243 }));
245 }
246
248 [
callback = std::make_unique<tonic::DartPersistentValue>(
250 weak_state = std::weak_ptr<MultiFrameCodec::State>(state_), trace_id,
251 ui_task_runner = task_runners.GetUITaskRunner(),
252 io_manager = dart_state->GetIOManager()]() mutable {
253 auto state = weak_state.lock();
254 if (!state) {
255 ui_task_runner->PostTask(fml::MakeCopyable(
256 [callback = std::move(callback)]() { callback->Clear(); }));
257 return;
258 }
259 state->GetNextFrameAndInvokeCallback(
260 std::move(
callback), ui_task_runner,
261 io_manager->GetResourceContext(), io_manager->GetSkiaUnrefQueue(),
262 io_manager->GetIsGpuDisabledSyncSwitch(), trace_id,
263 io_manager->GetImpellerContext());
264 }));
265
267
268
269
270}
static UIDartState * Current()
static DartState * Current()
DART_EXPORT Dart_Handle Dart_Null(void)
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_LOG(severity)
static void InvokeNextFrameCallback(const fml::RefPtr< CanvasImage > &image, int duration, const std::string &decode_error, std::unique_ptr< tonic::DartPersistentValue > callback, size_t trace_id)
internal::CopyableLambda< T > MakeCopyable(T lambda)
Dart_Handle ToDart(const T &object)