Don't send platform messages to isolates that are not running. (flutter/engine#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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user