未验证 提交 00911b2a 编写于 作者: C Chinmay Garde 提交者: GitHub

Don't send platform messages to isolates that are not running. (#5031)

Isolates may be launched and awaiting snapshot association. We don't
want to send such isolates any messages before their "main" method is
called. In such cases, the engine may intercept and store certain
launch specific information.
上级 5c857ee5
......@@ -78,6 +78,13 @@ RuntimeController::~RuntimeController() {
}
}
bool RuntimeController::IsRootIsolateRunning() const {
if (root_isolate_) {
return root_isolate_->GetPhase() == DartIsolate::Phase::Running;
}
return false;
}
std::unique_ptr<RuntimeController> RuntimeController::Clone() const {
return std::unique_ptr<RuntimeController>(new RuntimeController(
client_, //
......
......@@ -46,6 +46,8 @@ class RuntimeController final : public WindowClient {
bool NotifyIdle(int64_t deadline);
bool IsRootIsolateRunning() const;
bool DispatchPlatformMessage(fxl::RefPtr<PlatformMessage> message);
bool DispatchPointerDataPacket(const PointerDataPacket& packet);
......
......@@ -259,7 +259,8 @@ void Engine::DispatchPlatformMessage(
return;
}
if (runtime_controller_->DispatchPlatformMessage(std::move(message))) {
if (runtime_controller_->IsRootIsolateRunning() &&
runtime_controller_->DispatchPlatformMessage(std::move(message))) {
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册