30 {
32 if (override_context) {
33 return override_context;
34 }
35
37 if (!dart_state->IsImpellerEnabled()) {
38 out_error =
39 "Flutter GPU requires the Impeller rendering backend to be enabled.";
40 return nullptr;
41 }
42
43 std::promise<std::shared_ptr<impeller::Context>> context_promise;
44 auto impeller_context_future = context_promise.get_future();
46 dart_state->GetTaskRunners().GetIOTaskRunner(),
48 io_manager = dart_state->GetIOManager()]() mutable {
49 promise.set_value(io_manager ? io_manager->GetImpellerContext()
50 : nullptr);
51 }));
52 auto context = impeller_context_future.get();
53
54 if (!context) {
55 out_error = "Unable to retrieve the Impeller context.";
56 }
57 return context;
58}
static UIDartState * Current()
static std::shared_ptr< impeller::Context > GetOverrideContext()
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
internal::CopyableLambda< T > MakeCopyable(T lambda)