Flutter Engine
dart_isolate_unittests.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/runtime/dart_isolate.h"
6 
7 #include "flutter/fml/mapping.h"
8 #include "flutter/fml/synchronization/count_down_latch.h"
9 #include "flutter/fml/synchronization/waitable_event.h"
10 #include "flutter/fml/thread.h"
11 #include "flutter/runtime/dart_vm.h"
12 #include "flutter/runtime/dart_vm_lifecycle.h"
13 #include "flutter/runtime/isolate_configuration.h"
14 #include "flutter/testing/dart_isolate_runner.h"
15 #include "flutter/testing/fixture_test.h"
16 #include "flutter/testing/testing.h"
19 
20 namespace flutter {
21 namespace testing {
22 
23 class DartIsolateTest : public FixtureTest {
24  public:
26 
27  void Wait() { latch_.Wait(); }
28 
29  void Signal() { latch_.Signal(); }
30 
31  private:
33 
34  FML_DISALLOW_COPY_AND_ASSIGN(DartIsolateTest);
35 };
36 
37 TEST_F(DartIsolateTest, RootIsolateCreationAndShutdown) {
38  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
39  auto settings = CreateSettingsForFixture();
40  auto vm_ref = DartVMRef::Create(settings);
41  ASSERT_TRUE(vm_ref);
42  auto vm_data = vm_ref.GetVMData();
43  ASSERT_TRUE(vm_data);
44  TaskRunners task_runners(GetCurrentTestName(), //
49  );
50 
51  auto isolate_configuration =
53 
54  UIDartState::Context context(std::move(task_runners));
55  context.advisory_script_uri = "main.dart";
56  context.advisory_script_entrypoint = "main";
57  auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
58  vm_data->GetSettings(), // settings
59  vm_data->GetIsolateSnapshot(), // isolate snapshot
60  nullptr, // platform configuration
61  DartIsolate::Flags{}, // flags
62  nullptr, // root_isolate_create_callback
63  settings.isolate_create_callback, // isolate create callback
64  settings.isolate_shutdown_callback, // isolate shutdown callback
65  "main", // dart entrypoint
66  std::nullopt, // dart entrypoint library
67  std::move(isolate_configuration), // isolate configuration
68  std::move(context) // engine context
69  );
70  auto root_isolate = weak_isolate.lock();
71  ASSERT_TRUE(root_isolate);
72  ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running);
73  ASSERT_TRUE(root_isolate->Shutdown());
74 }
75 
76 TEST_F(DartIsolateTest, SpawnIsolate) {
77  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
78  auto settings = CreateSettingsForFixture();
79  auto vm_ref = DartVMRef::Create(settings);
80  ASSERT_TRUE(vm_ref);
81  auto vm_data = vm_ref.GetVMData();
82  ASSERT_TRUE(vm_data);
83  TaskRunners task_runners(GetCurrentTestName(), //
88  );
89 
90  auto isolate_configuration =
92 
93  UIDartState::Context context(std::move(task_runners));
94  context.advisory_script_uri = "main.dart";
95  context.advisory_script_entrypoint = "main";
96  auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
97  vm_data->GetSettings(), // settings
98  vm_data->GetIsolateSnapshot(), // isolate snapshot
99  nullptr, // platform configuration
100  DartIsolate::Flags{}, // flags
101  nullptr, // root_isolate_create_callback
102  settings.isolate_create_callback, // isolate create callback
103  settings.isolate_shutdown_callback, // isolate shutdown callback
104  "main", // dart entrypoint
105  std::nullopt, // dart entrypoint library
106  std::move(isolate_configuration), // isolate configuration
107  std::move(context) // engine context
108  );
109  auto root_isolate = weak_isolate.lock();
110  ASSERT_TRUE(root_isolate);
111  ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running);
112 
113  auto spawn_configuration = IsolateConfiguration::InferFromSettings(settings);
114 
115  auto weak_spawn = root_isolate->SpawnIsolate(
116  /*settings=*/vm_data->GetSettings(),
117  /*platform_configuration=*/nullptr,
118  /*snapshot_delegate=*/{},
119  /*advisory_script_uri=*/"main.dart",
120  /*advisory_script_entrypoint=*/"main",
121  /*flags=*/DartIsolate::Flags{},
122  /*isolate_create_callback=*/settings.isolate_create_callback,
123  /*isolate_shutdown_callback=*/settings.isolate_shutdown_callback,
124  /*dart_entrypoint=*/"main",
125  /*dart_entrypoint_library=*/std::nullopt,
126  /*isolate_configration=*/std::move(spawn_configuration));
127  auto spawn = weak_spawn.lock();
128  ASSERT_TRUE(spawn);
129  ASSERT_EQ(spawn->GetPhase(), DartIsolate::Phase::Running);
130 
131  // TODO(74520): Remove conditional once isolate groups are supported by JIT.
133  Dart_IsolateGroup isolate_group;
134  {
135  auto isolate_scope = tonic::DartIsolateScope(root_isolate->isolate());
136  isolate_group = Dart_CurrentIsolateGroup();
137  }
138  {
139  auto isolate_scope = tonic::DartIsolateScope(root_isolate->isolate());
140  Dart_IsolateGroup spawn_isolate_group = Dart_CurrentIsolateGroup();
141  ASSERT_TRUE(isolate_group != nullptr);
142  ASSERT_EQ(isolate_group, spawn_isolate_group);
143  }
144  }
145 
146  ASSERT_TRUE(spawn->Shutdown());
147  ASSERT_TRUE(spawn->IsShuttingDown());
148  ASSERT_TRUE(root_isolate->Shutdown());
149 }
150 
151 TEST_F(DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope) {
152  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
153  auto settings = CreateSettingsForFixture();
154  auto vm_ref = DartVMRef::Create(settings);
155  ASSERT_TRUE(vm_ref);
156  auto vm_data = vm_ref.GetVMData();
157  ASSERT_TRUE(vm_data);
158  TaskRunners task_runners(GetCurrentTestName(), //
163  );
164  auto isolate_configuration =
166 
167  UIDartState::Context context(std::move(task_runners));
168  context.advisory_script_uri = "main.dart";
169  context.advisory_script_entrypoint = "main";
170  auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
171  vm_data->GetSettings(), // settings
172  vm_data->GetIsolateSnapshot(), // isolate snapshot
173  nullptr, // platform configuration
174  DartIsolate::Flags{}, // flags
175  nullptr, // root_isolate_create_callback
176  settings.isolate_create_callback, // isolate create callback
177  settings.isolate_shutdown_callback, // isolate shutdown callback
178  "main", // dart entrypoint
179  std::nullopt, // dart entrypoint library
180  std::move(isolate_configuration), // isolate configuration
181  std::move(context) // engine context
182  );
183  auto root_isolate = weak_isolate.lock();
184  ASSERT_TRUE(root_isolate);
185  ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running);
186  size_t destruction_callback_count = 0;
187  root_isolate->AddIsolateShutdownCallback([&destruction_callback_count]() {
188  ASSERT_NE(Dart_CurrentIsolate(), nullptr);
189  destruction_callback_count++;
190  });
191  ASSERT_TRUE(root_isolate->Shutdown());
192  ASSERT_EQ(destruction_callback_count, 1u);
193 }
194 
195 TEST_F(DartIsolateTest, IsolateCanLoadAndRunDartCode) {
196  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
197  const auto settings = CreateSettingsForFixture();
198  auto vm_ref = DartVMRef::Create(settings);
199  TaskRunners task_runners(GetCurrentTestName(), //
204  );
205  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners, "main",
207  ASSERT_TRUE(isolate);
208  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
209 }
210 
211 TEST_F(DartIsolateTest, IsolateCannotLoadAndRunUnknownDartEntrypoint) {
212  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
213  const auto settings = CreateSettingsForFixture();
214  auto vm_ref = DartVMRef::Create(settings);
215  TaskRunners task_runners(GetCurrentTestName(), //
220  );
221  auto isolate =
222  RunDartCodeInIsolate(vm_ref, settings, task_runners, "thisShouldNotExist",
224  ASSERT_FALSE(isolate);
225 }
226 
227 TEST_F(DartIsolateTest, CanRunDartCodeCodeSynchronously) {
228  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
229  const auto settings = CreateSettingsForFixture();
230  auto vm_ref = DartVMRef::Create(settings);
231  TaskRunners task_runners(GetCurrentTestName(), //
236  );
237  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners, "main",
239 
240  ASSERT_TRUE(isolate);
241  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
242  ASSERT_TRUE(isolate->RunInIsolateScope([]() -> bool {
243  if (tonic::LogIfError(::Dart_Invoke(Dart_RootLibrary(),
244  tonic::ToDart("sayHi"), 0, nullptr))) {
245  return false;
246  }
247  return true;
248  }));
249 }
250 
251 TEST_F(DartIsolateTest, CanRegisterNativeCallback) {
252  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
254  "NotifyNative",
255  CREATE_NATIVE_ENTRY(([this](Dart_NativeArguments args) { Signal(); })));
256  const auto settings = CreateSettingsForFixture();
257  auto vm_ref = DartVMRef::Create(settings);
258  auto thread = CreateNewThread();
259  TaskRunners task_runners(GetCurrentTestName(), //
260  thread, //
261  thread, //
262  thread, //
263  thread //
264  );
265  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners,
266  "canRegisterNativeCallback", {},
268  ASSERT_TRUE(isolate);
269  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
270  Wait();
271 }
272 
274  public:
275  DartSecondaryIsolateTest() : latch_(3) {}
276 
277  void LatchCountDown() { latch_.CountDown(); }
278 
279  void LatchWait() { latch_.Wait(); }
280 
281  void ChildShutdownSignal() { child_shutdown_latch_.Signal(); }
282 
283  void ChildShutdownWait() { child_shutdown_latch_.Wait(); }
284 
285  void RootIsolateShutdownSignal() { root_isolate_shutdown_latch_.Signal(); }
286 
288  return root_isolate_shutdown_latch_.IsSignaledForTest();
289  }
290 
291  private:
292  fml::CountDownLatch latch_;
293  fml::AutoResetWaitableEvent child_shutdown_latch_;
294  fml::AutoResetWaitableEvent root_isolate_shutdown_latch_;
295 
297 };
298 
299 TEST_F(DartSecondaryIsolateTest, CanLaunchSecondaryIsolates) {
300  AddNativeCallback("NotifyNative",
301  CREATE_NATIVE_ENTRY(([this](Dart_NativeArguments args) {
302  LatchCountDown();
303  })));
305  "PassMessage", CREATE_NATIVE_ENTRY(([this](Dart_NativeArguments args) {
307  Dart_GetNativeArgument(args, 0));
308  ASSERT_EQ("Hello from code is secondary isolate.", message);
309  LatchCountDown();
310  })));
311  auto settings = CreateSettingsForFixture();
312  settings.root_isolate_shutdown_callback = [this]() {
313  RootIsolateShutdownSignal();
314  };
315  settings.isolate_shutdown_callback = [this]() { ChildShutdownSignal(); };
316  auto vm_ref = DartVMRef::Create(settings);
317  auto thread = CreateNewThread();
318  TaskRunners task_runners(GetCurrentTestName(), //
319  thread, //
320  thread, //
321  thread, //
322  thread //
323  );
324  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners,
325  "testCanLaunchSecondaryIsolate", {},
327  ASSERT_TRUE(isolate);
328  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
329  ChildShutdownWait(); // wait for child isolate to shutdown first
330  ASSERT_FALSE(RootIsolateIsSignaled());
331  LatchWait(); // wait for last NotifyNative called by main isolate
332  // root isolate will be auto-shutdown
333 }
334 
335 TEST_F(DartIsolateTest, CanRecieveArguments) {
336  AddNativeCallback("NotifyNative",
337  CREATE_NATIVE_ENTRY(([this](Dart_NativeArguments args) {
339  Dart_GetNativeArgument(args, 0)));
340  Signal();
341  })));
342 
343  const auto settings = CreateSettingsForFixture();
344  auto vm_ref = DartVMRef::Create(settings);
345  auto thread = CreateNewThread();
346  TaskRunners task_runners(GetCurrentTestName(), //
347  thread, //
348  thread, //
349  thread, //
350  thread //
351  );
352  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners,
353  "testCanRecieveArguments", {"arg1"},
355  ASSERT_TRUE(isolate);
356  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
357 
358  Wait();
359 }
360 
361 TEST_F(DartIsolateTest, CanCreateServiceIsolate) {
362 #if (FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DEBUG) && \
363  (FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_PROFILE)
364  GTEST_SKIP();
365 #endif
366  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
367  fml::AutoResetWaitableEvent service_isolate_latch;
368  auto settings = CreateSettingsForFixture();
369  settings.enable_observatory = true;
370  settings.observatory_port = 0;
371  settings.observatory_host = "127.0.0.1";
372  settings.enable_service_port_fallback = true;
373  settings.service_isolate_create_callback = [&service_isolate_latch]() {
374  service_isolate_latch.Signal();
375  };
376  auto vm_ref = DartVMRef::Create(settings);
377  ASSERT_TRUE(vm_ref);
378  auto vm_data = vm_ref.GetVMData();
379  ASSERT_TRUE(vm_data);
380  TaskRunners task_runners(GetCurrentTestName(), //
385  );
386 
387  auto isolate_configuration =
389 
390  UIDartState::Context context(std::move(task_runners));
391  context.advisory_script_uri = "main.dart";
392  context.advisory_script_entrypoint = "main";
393  auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
394  vm_data->GetSettings(), // settings
395  vm_data->GetIsolateSnapshot(), // isolate snapshot
396  nullptr, // platform configuration
397  DartIsolate::Flags{}, // flags
398  nullptr, // root_isolate_create_callback
399  settings.isolate_create_callback, // isolate create callback
400  settings.isolate_shutdown_callback, // isolate shutdown callback
401  "main", // dart entrypoint
402  std::nullopt, // dart entrypoint library
403  std::move(isolate_configuration), // isolate configuration
404  std::move(context) // engine context
405  );
406 
407  auto root_isolate = weak_isolate.lock();
408  ASSERT_TRUE(root_isolate);
409  ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running);
410  service_isolate_latch.Wait();
411  ASSERT_TRUE(root_isolate->Shutdown());
412 }
413 
415  RootIsolateCreateCallbackIsMadeOnceAndBeforeIsolateRunning) {
416  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
417  auto settings = CreateSettingsForFixture();
418  size_t create_callback_count = 0u;
419  settings.root_isolate_create_callback =
420  [&create_callback_count](const auto& isolate) {
421  ASSERT_EQ(isolate.GetPhase(), DartIsolate::Phase::Ready);
422  create_callback_count++;
423  ASSERT_NE(::Dart_CurrentIsolate(), nullptr);
424  };
425  auto vm_ref = DartVMRef::Create(settings);
426  TaskRunners task_runners(GetCurrentTestName(), //
431  );
432  {
433  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners, "main",
435  ASSERT_TRUE(isolate);
436  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
437  }
438  ASSERT_EQ(create_callback_count, 1u);
439 }
440 
442  IsolateCreateCallbacksTakeInstanceSettingsInsteadOfVMSettings) {
443  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
444  auto vm_settings = CreateSettingsForFixture();
445  auto vm_ref = DartVMRef::Create(vm_settings);
446  auto instance_settings = vm_settings;
447  size_t create_callback_count = 0u;
448  instance_settings.root_isolate_create_callback =
449  [&create_callback_count](const auto& isolate) {
450  ASSERT_EQ(isolate.GetPhase(), DartIsolate::Phase::Ready);
451  create_callback_count++;
452  ASSERT_NE(::Dart_CurrentIsolate(), nullptr);
453  };
454  TaskRunners task_runners(GetCurrentTestName(), //
459  );
460  {
461  auto isolate = RunDartCodeInIsolate(vm_ref, instance_settings, task_runners,
462  "main", {}, GetDefaultKernelFilePath());
463  ASSERT_TRUE(isolate);
464  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
465  }
466  ASSERT_EQ(create_callback_count, 1u);
467 }
468 
469 TEST_F(DartIsolateTest, InvalidLoadingUnitFails) {
471  FML_LOG(INFO) << "Split AOT does not work in JIT mode";
472  return;
473  }
474  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
475  auto settings = CreateSettingsForFixture();
476  auto vm_ref = DartVMRef::Create(settings);
477  ASSERT_TRUE(vm_ref);
478  auto vm_data = vm_ref.GetVMData();
479  ASSERT_TRUE(vm_data);
480  TaskRunners task_runners(GetCurrentTestName(), //
485  );
486  auto isolate_configuration =
488 
489  UIDartState::Context context(std::move(task_runners));
490  context.advisory_script_uri = "main.dart";
491  context.advisory_script_entrypoint = "main";
492  auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
493  vm_data->GetSettings(), // settings
494  vm_data->GetIsolateSnapshot(), // isolate snapshot
495  nullptr, // platform configuration
496  DartIsolate::Flags{}, // flags
497  nullptr, // root_isolate_create_callback
498  settings.isolate_create_callback, // isolate create callback
499  settings.isolate_shutdown_callback, // isolate shutdown callback
500  "main", // dart entrypoint
501  std::nullopt, // dart entrypoint library
502  std::move(isolate_configuration), // isolate configuration
503  std::move(context) // engine context
504  );
505 
506  auto root_isolate = weak_isolate.lock();
507  ASSERT_TRUE(root_isolate);
508  ASSERT_EQ(root_isolate->GetPhase(), DartIsolate::Phase::Running);
509 
510  auto isolate_data = std::make_unique<const fml::NonOwnedMapping>(
512  auto isolate_instructions = std::make_unique<const fml::NonOwnedMapping>(
514 
515  // Invalid loading unit should fail gracefully with error message.
516  ASSERT_FALSE(root_isolate->LoadLoadingUnit(3, std::move(isolate_data),
517  std::move(isolate_instructions)));
518  ASSERT_TRUE(root_isolate->Shutdown());
519 }
520 
521 // TODO(garyq): Re-enable this test, and resolve dart-side hanging future and
522 // threading. See https://github.com/flutter/flutter/issues/72312
523 TEST_F(DartIsolateTest, DISABLED_ValidLoadingUnitSucceeds) {
525  FML_LOG(INFO) << "Split AOT does not work in JIT mode";
526  return;
527  }
528 
529  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
531  "NotifyNative",
532  CREATE_NATIVE_ENTRY(([this](Dart_NativeArguments args) { Signal(); })));
534  "NotifySuccess", CREATE_NATIVE_ENTRY([this](Dart_NativeArguments args) {
535  auto bool_handle = Dart_GetNativeArgument(args, 0);
536  ASSERT_FALSE(tonic::LogIfError(bool_handle));
537  ASSERT_TRUE(tonic::DartConverter<bool>::FromDart(bool_handle));
538  Signal();
539  }));
540  const auto settings = CreateSettingsForFixture();
541  auto vm_ref = DartVMRef::Create(settings);
542  auto thread = CreateNewThread();
543  TaskRunners task_runners(GetCurrentTestName(), //
544  thread, //
545  thread, //
546  thread, //
547  thread //
548  );
549  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners,
550  "canCallDeferredLibrary", {},
552  ASSERT_TRUE(isolate);
553  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
554  Wait();
555 
556  auto isolate_data = std::make_unique<const fml::NonOwnedMapping>(
558  auto isolate_instructions = std::make_unique<const fml::NonOwnedMapping>(
560 
561  ASSERT_TRUE(isolate->get()->LoadLoadingUnit(2, std::move(isolate_data),
562  std::move(isolate_instructions)));
563  Wait();
564 }
565 
566 TEST_F(DartIsolateTest, DartPluginRegistrantIsCalled) {
567  ASSERT_FALSE(DartVMRef::IsInstanceRunning());
568 
569  std::vector<std::string> messages;
571 
573  "PassMessage",
574  CREATE_NATIVE_ENTRY(([&latch, &messages](Dart_NativeArguments args) {
576  Dart_GetNativeArgument(args, 0));
577  messages.push_back(message);
578  latch.Signal();
579  })));
580 
581  const auto settings = CreateSettingsForFixture();
582  auto vm_ref = DartVMRef::Create(settings);
583  auto thread = CreateNewThread();
584  TaskRunners task_runners(GetCurrentTestName(), //
585  thread, //
586  thread, //
587  thread, //
588  thread //
589  );
590  auto isolate = RunDartCodeInIsolate(vm_ref, settings, task_runners,
591  "mainForPluginRegistrantTest", {},
593  ASSERT_TRUE(isolate);
594  ASSERT_EQ(isolate->get()->GetPhase(), DartIsolate::Phase::Running);
595  latch.Wait();
596  ASSERT_EQ(messages.size(), 1u);
597  ASSERT_EQ(messages[0], "_PluginRegistrant.register() was called");
598 }
599 
600 } // namespace testing
601 } // namespace flutter
G_BEGIN_DECLS FlValue * args
fml::RefPtr< fml::TaskRunner > GetCurrentTaskRunner()
Get the task runner for the thread that the current unit-test is running on. This creates a message l...
Definition: thread_test.cc:22
std::string GetDefaultKernelFilePath()
Returns the default path to kernel_blob.bin. This file is within the directory returned by GetFixture...
Definition: testing.cc:17
fml::RefPtr< fml::TaskRunner > CreateNewThread(std::string name="")
Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test...
Definition: thread_test.cc:26
std::string GetCurrentTestName()
Gets the name of the currently running test. This is useful in generating logs or assets based on tes...
Definition: testing.cc:13
const uint8_t * vm_isolate_data
Definition: elf_loader.h:37
#define FML_LOG(severity)
Definition: logging.h:65
std::unique_ptr< AutoIsolateShutdown > RunDartCodeInIsolate(DartVMRef &vm_ref, const Settings &settings, const TaskRunners &task_runners, std::string entrypoint, const std::vector< std::string > &args, const std::string &kernel_file_path, fml::WeakPtr< IOManager > io_manager, std::shared_ptr< VolatilePathTracker > volatile_path_tracker)
static bool IsInstanceRunning()
static DartVMRef Create(Settings settings, fml::RefPtr< const DartSnapshot > vm_snapshot=nullptr, fml::RefPtr< const DartSnapshot > isolate_snapshot=nullptr)
ELFAOTSymbols split_aot_symbols_
Definition: dart_fixture.h:37
static std::unique_ptr< IsolateConfiguration > InferFromSettings(const Settings &settings, std::shared_ptr< AssetManager > asset_manager=nullptr, fml::RefPtr< fml::TaskRunner > io_worker=nullptr)
Attempts to infer the isolate configuration from the Settings object. If the VM is configured for AOT...
#define CREATE_NATIVE_ENTRY(native_entry)
static bool IsRunningPrecompiledCode()
Checks if VM instances in the process can run precompiled code. This call can be made at any time and...
Definition: dart_vm.cc:202
The subset of state which is owned by the shell or engine and passed through the RuntimeController in...
Definition: ui_dart_state.h:43
virtual Settings CreateSettingsForFixture()
Definition: dart_fixture.cc:26
const uint8_t * vm_isolate_instrs
Definition: elf_loader.h:38
TEST_F(BackdropFilterLayerTest, PaintingEmptyLayerDies)
std::string advisory_script_entrypoint
Definition: ui_dart_state.h:88
static std::weak_ptr< DartIsolate > CreateRunningRootIsolate(const Settings &settings, fml::RefPtr< const DartSnapshot > isolate_snapshot, std::unique_ptr< PlatformConfiguration > platform_configuration, Flags flags, fml::closure root_isolate_create_callback, const fml::closure &isolate_create_callback, const fml::closure &isolate_shutdown_callback, std::optional< std::string > dart_entrypoint, std::optional< std::string > dart_entrypoint_library, std::unique_ptr< IsolateConfiguration > isolate_configration, const UIDartState::Context &context, const DartIsolate *spawning_isolate=nullptr)
Creates an instance of a root isolate and returns a weak pointer to the same. The isolate instance ma...
bool LogIfError(Dart_Handle handle)
Definition: dart_error.cc:15
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
void AddNativeCallback(std::string name, Dart_NativeFunction callback)
Definition: dart_fixture.cc:67