Remove some obsolete code from RuntimeController (flutter/engine#22091)

This commit is contained in:
Jason Simmons 2020-10-26 10:42:02 -07:00 committed by GitHub
parent 8055fe0b28
commit 73ea2c2fea
2 changed files with 7 additions and 31 deletions

View File

@ -69,7 +69,7 @@ RuntimeController::~RuntimeController() {
}
bool RuntimeController::IsRootIsolateRunning() {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
if (root_isolate) {
return root_isolate->GetPhase() == DartIsolate::Phase::Running;
}
@ -196,7 +196,7 @@ bool RuntimeController::ReportTimings(std::vector<int64_t> timings) {
}
bool RuntimeController::NotifyIdle(int64_t deadline, size_t freed_hint) {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
if (!root_isolate) {
return false;
}
@ -256,7 +256,7 @@ bool RuntimeController::DispatchSemanticsAction(int32_t id,
PlatformConfiguration*
RuntimeController::GetPlatformConfigurationIfAvailable() {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
return root_isolate ? root_isolate->platform_configuration() : nullptr;
}
@ -318,17 +318,17 @@ RuntimeController::ComputePlatformResolvedLocale(
}
Dart_Port RuntimeController::GetMainPort() {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
return root_isolate ? root_isolate->main_port() : ILLEGAL_PORT;
}
std::string RuntimeController::GetIsolateName() {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
return root_isolate ? root_isolate->debug_name() : "";
}
bool RuntimeController::HasLivePorts() {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
if (!root_isolate) {
return false;
}
@ -337,7 +337,7 @@ bool RuntimeController::HasLivePorts() {
}
tonic::DartErrorHandleType RuntimeController::GetLastError() {
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
return root_isolate ? root_isolate->GetLastError() : tonic::kNoError;
}
@ -411,15 +411,6 @@ std::optional<std::string> RuntimeController::GetRootIsolateServiceID() const {
return std::nullopt;
}
std::weak_ptr<DartIsolate> RuntimeController::GetRootIsolate() {
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
if (root_isolate) {
return root_isolate_;
}
return root_isolate_;
}
std::optional<uint32_t> RuntimeController::GetRootIsolateReturnCode() {
return root_isolate_return_code_;
}

View File

@ -5,7 +5,6 @@
#ifndef FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
#define FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
#include <future>
#include <memory>
#include <vector>
@ -506,10 +505,6 @@ class RuntimeController : public PlatformConfigurationClient {
std::string advisory_script_entrypoint_;
std::function<void(int64_t)> idle_notification_callback_;
PlatformData platform_data_;
std::future<void> create_and_config_root_isolate_;
// Note that `root_isolate_` is created asynchronously from the constructor of
// `RuntimeController`, be careful to use it directly while it might have not
// been created yet. Call `GetRootIsolate()` instead which guarantees that.
std::weak_ptr<DartIsolate> root_isolate_;
std::optional<uint32_t> root_isolate_return_code_;
const fml::closure isolate_create_callback_;
@ -552,16 +547,6 @@ class RuntimeController : public PlatformConfigurationClient {
std::unique_ptr<std::vector<std::string>> ComputePlatformResolvedLocale(
const std::vector<std::string>& supported_locale_data) override;
//----------------------------------------------------------------------------
/// @brief Get a weak pointer to the root Dart isolate. This isolate may
/// only be locked on the UI task runner. Callers use this
/// accessor to transition to the root isolate to the running
/// phase.
///
/// @return The root isolate reference.
///
std::weak_ptr<DartIsolate> GetRootIsolate();
FML_DISALLOW_COPY_AND_ASSIGN(RuntimeController);
};