Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
flutter::PlatformIsolateNativeApi Class Reference

#include <platform_isolate.h>

Static Public Member Functions

static void Spawn (Dart_Handle entry_point)
 
static bool IsRunningOnPlatformThread ()
 

Detailed Description

Definition at line 12 of file platform_isolate.h.

Member Function Documentation

◆ IsRunningOnPlatformThread()

bool flutter::PlatformIsolateNativeApi::IsRunningOnPlatformThread ( )
static

Definition at line 36 of file platform_isolate.cc.

36 {
37 UIDartState* current_state = UIDartState::Current();
38 FML_DCHECK(current_state != nullptr);
39 fml::RefPtr<fml::TaskRunner> platform_task_runner =
40 current_state->GetTaskRunners().GetPlatformTaskRunner();
41 if (!platform_task_runner) {
42 return false;
43 }
44 return platform_task_runner->RunsTasksOnCurrentThread();
45}
static UIDartState * Current()
virtual bool RunsTasksOnCurrentThread()
Definition: task_runner.cc:43
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ Spawn()

void flutter::PlatformIsolateNativeApi::Spawn ( Dart_Handle  entry_point)
static

Definition at line 16 of file platform_isolate.cc.

16 {
17 UIDartState* current_state = UIDartState::Current();
18 FML_DCHECK(current_state != nullptr);
19 if (!current_state->IsRootIsolate()) {
20 // TODO(flutter/flutter#136314): Remove this restriction.
23 "PlatformIsolates can only be spawned on the root isolate."));
24 }
25
26 char* error = nullptr;
27 current_state->CreatePlatformIsolate(entry_point, &error);
28 if (error) {
30 Dart_Handle error_handle = tonic::ToDart<const char*>(error);
31 ::free(error);
32 Dart_ThrowException(error_handle);
33 }
34}
DART_EXPORT void Dart_EnterScope(void)
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
const uint8_t uint32_t uint32_t GError ** error
Dart_Handle ToDart(const T &object)

The documentation for this class was generated from the following files: