|
20 | 20 | #include "runtime/dart/utils/files.h" |
21 | 21 | #include "task_runner_adapter.h" |
22 | 22 | #include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" |
23 | | -#include "thread.h" |
24 | 23 |
|
25 | 24 | namespace flutter_runner { |
26 | 25 |
|
@@ -60,19 +59,16 @@ Engine::Engine(Delegate& delegate, |
60 | 59 | fidl::InterfaceRequest<fuchsia::io::Directory> directory_request) |
61 | 60 | : delegate_(delegate), |
62 | 61 | thread_label_(std::move(thread_label)), |
| 62 | + thread_host_(thread_label_ + ".", |
| 63 | + flutter::ThreadHost::Type::Platform | flutter::ThreadHost::Type::IO | |
| 64 | + flutter::ThreadHost::Type::UI | flutter::ThreadHost::Type::GPU), |
63 | 65 | settings_(std::move(settings)), |
64 | 66 | weak_factory_(this) { |
65 | 67 | if (zx::event::create(0, &vsync_event_) != ZX_OK) { |
66 | 68 | FML_DLOG(ERROR) << "Could not create the vsync event."; |
67 | 69 | return; |
68 | 70 | } |
69 | 71 |
|
70 | | - // Launch the threads that will be used to run the shell. These threads will |
71 | | - // be joined in the destructor. |
72 | | - for (auto& thread : threads_) { |
73 | | - thread.reset(new Thread()); |
74 | | - } |
75 | | - |
76 | 72 | // Set up the session connection. |
77 | 73 | auto scenic = svc->Connect<fuchsia::ui::scenic::Scenic>(); |
78 | 74 | fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session; |
@@ -169,10 +165,10 @@ Engine::Engine(Delegate& delegate, |
169 | 165 | // used as the "platform" thread. |
170 | 166 | const flutter::TaskRunners task_runners( |
171 | 167 | thread_label_, // Dart thread labels |
172 | | - CreateFMLTaskRunner(async_get_default_dispatcher()), // platform |
173 | | - CreateFMLTaskRunner(threads_[0]->dispatcher()), // gpu |
174 | | - CreateFMLTaskRunner(threads_[1]->dispatcher()), // ui |
175 | | - CreateFMLTaskRunner(threads_[2]->dispatcher()) // io |
| 168 | + thread_host_.platform_thread->GetTaskRunner(), // platform |
| 169 | + thread_host_.gpu_thread->GetTaskRunner(), // gpu |
| 170 | + thread_host_.ui_thread->GetTaskRunner(), // ui |
| 171 | + thread_host_.io_thread->GetTaskRunner() // io |
176 | 172 | ); |
177 | 173 |
|
178 | 174 | // Setup the callback that will instantiate the rasterizer. |
@@ -352,12 +348,6 @@ Engine::Engine(Delegate& delegate, |
352 | 348 |
|
353 | 349 | Engine::~Engine() { |
354 | 350 | shell_.reset(); |
355 | | - for (const auto& thread : threads_) { |
356 | | - thread->Quit(); |
357 | | - } |
358 | | - for (const auto& thread : threads_) { |
359 | | - thread->Join(); |
360 | | - } |
361 | 351 | } |
362 | 352 |
|
363 | 353 | std::pair<bool, uint32_t> Engine::GetEngineReturnCode() const { |
|
0 commit comments