Flutter Engine
 
Loading...
Searching...
No Matches
dart_isolate_runner.h
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#ifndef FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
6#define FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
7
10#include "flutter/fml/paths.h"
12#include "flutter/fml/thread.h"
16
17namespace flutter::testing {
18
20 public:
22
23 AutoIsolateShutdown(std::shared_ptr<DartIsolate> isolate,
25
27
28 bool IsValid() const { return isolate_ != nullptr && runner_; }
29
30 [[nodiscard]] bool RunInIsolateScope(
31 const std::function<bool(void)>& closure);
32
33 void Shutdown();
34
36 FML_CHECK(isolate_);
37 return isolate_.get();
38 }
39
40 private:
41 std::shared_ptr<DartIsolate> isolate_;
43
45};
46
48 DartVMRef& vm_ref,
49 std::unique_ptr<AutoIsolateShutdown>& result,
50 const Settings& settings,
51 const TaskRunners& task_runners,
52 std::string entrypoint,
53 const std::vector<std::string>& args,
54 const std::string& fixtures_path,
55 fml::WeakPtr<IOManager> io_manager = {},
56 std::unique_ptr<PlatformConfiguration> platform_configuration = nullptr);
57
58std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolate(
59 DartVMRef& vm_ref,
60 const Settings& settings,
61 const TaskRunners& task_runners,
62 std::string entrypoint,
63 const std::vector<std::string>& args,
64 const std::string& fixtures_path,
65 fml::WeakPtr<IOManager> io_manager = {},
66 std::unique_ptr<PlatformConfiguration> platform_configuration = nullptr);
67
68} // namespace flutter::testing
69
70#endif // FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
Represents an instance of a live isolate. An isolate is a separate Dart execution context....
bool RunInIsolateScope(const std::function< bool(void)> &closure)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define FML_CHECK(condition)
Definition logging.h:104
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
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::unique_ptr< PlatformConfiguration > platform_configuration)