Skip to content

Commit 68e9d04

Browse files
committed
Remove some obsolete code from RuntimeController
These changes were introduced by the async CreateRootIsolate patch (flutter#21747). They are no longer needed for the sound null safety snapshot loader (flutter#21820)
1 parent 1857470 commit 68e9d04

File tree

2 files changed

+7
-31
lines changed

2 files changed

+7
-31
lines changed

runtime/runtime_controller.cc

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ RuntimeController::~RuntimeController() {
6969
}
7070

7171
bool RuntimeController::IsRootIsolateRunning() {
72-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
72+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
7373
if (root_isolate) {
7474
return root_isolate->GetPhase() == DartIsolate::Phase::Running;
7575
}
@@ -196,7 +196,7 @@ bool RuntimeController::ReportTimings(std::vector<int64_t> timings) {
196196
}
197197

198198
bool RuntimeController::NotifyIdle(int64_t deadline, size_t freed_hint) {
199-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
199+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
200200
if (!root_isolate) {
201201
return false;
202202
}
@@ -256,7 +256,7 @@ bool RuntimeController::DispatchSemanticsAction(int32_t id,
256256

257257
PlatformConfiguration*
258258
RuntimeController::GetPlatformConfigurationIfAvailable() {
259-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
259+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
260260
return root_isolate ? root_isolate->platform_configuration() : nullptr;
261261
}
262262

@@ -318,17 +318,17 @@ RuntimeController::ComputePlatformResolvedLocale(
318318
}
319319

320320
Dart_Port RuntimeController::GetMainPort() {
321-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
321+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
322322
return root_isolate ? root_isolate->main_port() : ILLEGAL_PORT;
323323
}
324324

325325
std::string RuntimeController::GetIsolateName() {
326-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
326+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
327327
return root_isolate ? root_isolate->debug_name() : "";
328328
}
329329

330330
bool RuntimeController::HasLivePorts() {
331-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
331+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
332332
if (!root_isolate) {
333333
return false;
334334
}
@@ -337,7 +337,7 @@ bool RuntimeController::HasLivePorts() {
337337
}
338338

339339
tonic::DartErrorHandleType RuntimeController::GetLastError() {
340-
std::shared_ptr<DartIsolate> root_isolate = GetRootIsolate().lock();
340+
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
341341
return root_isolate ? root_isolate->GetLastError() : tonic::kNoError;
342342
}
343343

@@ -411,15 +411,6 @@ std::optional<std::string> RuntimeController::GetRootIsolateServiceID() const {
411411
return std::nullopt;
412412
}
413413

414-
std::weak_ptr<DartIsolate> RuntimeController::GetRootIsolate() {
415-
std::shared_ptr<DartIsolate> root_isolate = root_isolate_.lock();
416-
if (root_isolate) {
417-
return root_isolate_;
418-
}
419-
420-
return root_isolate_;
421-
}
422-
423414
std::optional<uint32_t> RuntimeController::GetRootIsolateReturnCode() {
424415
return root_isolate_return_code_;
425416
}

runtime/runtime_controller.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#ifndef FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
66
#define FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
77

8-
#include <future>
98
#include <memory>
109
#include <vector>
1110

@@ -506,10 +505,6 @@ class RuntimeController : public PlatformConfigurationClient {
506505
std::string advisory_script_entrypoint_;
507506
std::function<void(int64_t)> idle_notification_callback_;
508507
PlatformData platform_data_;
509-
std::future<void> create_and_config_root_isolate_;
510-
// Note that `root_isolate_` is created asynchronously from the constructor of
511-
// `RuntimeController`, be careful to use it directly while it might have not
512-
// been created yet. Call `GetRootIsolate()` instead which guarantees that.
513508
std::weak_ptr<DartIsolate> root_isolate_;
514509
std::optional<uint32_t> root_isolate_return_code_;
515510
const fml::closure isolate_create_callback_;
@@ -552,16 +547,6 @@ class RuntimeController : public PlatformConfigurationClient {
552547
std::unique_ptr<std::vector<std::string>> ComputePlatformResolvedLocale(
553548
const std::vector<std::string>& supported_locale_data) override;
554549

555-
//----------------------------------------------------------------------------
556-
/// @brief Get a weak pointer to the root Dart isolate. This isolate may
557-
/// only be locked on the UI task runner. Callers use this
558-
/// accessor to transition to the root isolate to the running
559-
/// phase.
560-
///
561-
/// @return The root isolate reference.
562-
///
563-
std::weak_ptr<DartIsolate> GetRootIsolate();
564-
565550
FML_DISALLOW_COPY_AND_ASSIGN(RuntimeController);
566551
};
567552

0 commit comments

Comments
 (0)