Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b297499

Browse files
committed
Additional cleanup and docs
Build on host
1 parent 42df4d0 commit b297499

File tree

8 files changed

+44
-97
lines changed

8 files changed

+44
-97
lines changed

runtime/dart_isolate.cc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,6 @@ std::string DartIsolate::GetServiceId() {
292292
return service_id;
293293
}
294294

295-
// Dart_Handle DartDeferredLoadHandler(intptr_t loading_unit_id) {
296-
// FML_LOG(ERROR) << "LOAD REQUEST CALLED FOR ID: " << loading_unit_id;
297-
// // Temporary call for prototyping.
298-
// return
299-
// Engine::GetEngineDelegateTemp()->OnDartLoadLibrary(loading_unit_id);
300-
// }
301-
302295
bool DartIsolate::Initialize(Dart_Isolate dart_isolate,
303296
Dart_DeferredLoadHandler& deferred_load_handler) {
304297
TRACE_EVENT0("flutter", "DartIsolate::Initialize");
@@ -709,8 +702,7 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
709702

710703
if (!vm_data) {
711704
*error = fml::strdup(
712-
"Could not access VM data to initialize isolates. This may be "
713-
"because "
705+
"Could not access VM data to initialize isolates. This may be because "
714706
"the VM has initialized shutdown on another thread already.");
715707
return nullptr;
716708
}
@@ -728,8 +720,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
728720

729721
#if (FLUTTER_RUNTIME_MODE != FLUTTER_RUNTIME_MODE_DEBUG)
730722
// TODO(68663): The service isolate in debug mode is always launched without
731-
// sound null safety. Fix after the isolate snapshot data is created with
732-
// the right flags.
723+
// sound null safety. Fix after the isolate snapshot data is created with the
724+
// right flags.
733725
flags->null_safety =
734726
vm_data->GetIsolateSnapshot()->IsNullSafetyEnabled(nullptr);
735727
#endif

runtime/dart_isolate_unittests.cc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,19 @@ TEST_F(DartIsolateTest, CanCreateServiceIsolate) {
353353
auto isolate_configuration =
354354
IsolateConfiguration::InferFromSettings(settings);
355355
auto weak_isolate = DartIsolate::CreateRunningRootIsolate(
356-
vm_data->GetSettings(), // settings
357-
vm_data->GetIsolateSnapshot(), // isolate snapshot
358-
std::move(task_runners), // task runners
359-
nullptr, // window
360-
{}, // snapshot delegate
361-
{}, // hint freed delegate
362-
{}, // io manager
363-
{}, // unref queue
364-
{}, // image decoder
365-
"main.dart", // advisory uri
366-
"main", // advisory entrypoint,
367-
DartIsolate::Flags{}, // flags
356+
vm_data->GetSettings(), // settings
357+
vm_data->GetIsolateSnapshot(), // isolate snapshot
358+
std::move(task_runners), // task runners
359+
nullptr, // window
360+
{}, // snapshot delegate
361+
{}, // hint freed delegate
362+
{}, // io manager
363+
{}, // unref queue
364+
{}, // image decoder
365+
"main.dart", // advisory uri
366+
"main", // advisory entrypoint,
367+
DartIsolate::Flags{}, // flags
368+
DartDeferredLoadHandler::empty_dart_deferred_load_handler,
368369
settings.isolate_create_callback, // isolate create callback
369370
settings.isolate_shutdown_callback, // isolate shutdown callback
370371
"main", // dart entrypoint

runtime/dart_lifecycle_unittests.cc

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,43 +52,25 @@ static std::shared_ptr<DartIsolate> CreateAndRunRootIsolate(
5252
FML_CHECK(entrypoint.size() > 0);
5353
TaskRunners runners("io.flutter.test", task_runner, task_runner, task_runner,
5454
task_runner);
55-
auto isolate_weak = DartIsolate::CreateRootIsolate(
56-
vm.GetSettings(), // settings
57-
vm.GetIsolateSnapshot(), // isolate_snapshot
58-
runners, // task_runners
59-
{}, // window
60-
{}, // snapshot_delegate
61-
{}, // hint_freed_delegate
62-
{}, // io_manager
63-
{}, // unref_queue
64-
{}, // image_decoder
65-
"main.dart", // advisory_script_uri
66-
entrypoint.c_str(), // advisory_script_entrypoint
67-
nullptr, // flags
68-
DartDeferredLoadHandler::empty_dart_deferred_load_handler,
69-
settings.isolate_create_callback, // isolate create callback
70-
settings.isolate_shutdown_callback // isolate shutdown callback
71-
);
72-
73-
auto isolate = isolate_weak.lock();
7455

7556
auto isolate_configuration =
7657
IsolateConfiguration::InferFromSettings(settings);
7758

7859
auto isolate =
7960
DartIsolate::CreateRunningRootIsolate(
80-
vm.GetSettings(), // settings
81-
vm.GetIsolateSnapshot(), // isolate_snapshot
82-
runners, // task_runners
83-
{}, // window
84-
{}, // snapshot_delegate
85-
{}, // hint_freed_delegate
86-
{}, // io_manager
87-
{}, // unref_queue
88-
{}, // image_decoder
89-
"main.dart", // advisory_script_uri
90-
entrypoint.c_str(), // advisory_script_entrypoint
91-
DartIsolate::Flags{}, // flags
61+
vm.GetSettings(), // settings
62+
vm.GetIsolateSnapshot(), // isolate_snapshot
63+
runners, // task_runners
64+
{}, // window
65+
{}, // snapshot_delegate
66+
{}, // hint_freed_delegate
67+
{}, // io_manager
68+
{}, // unref_queue
69+
{}, // image_decoder
70+
"main.dart", // advisory_script_uri
71+
entrypoint.c_str(), // advisory_script_entrypoint
72+
DartIsolate::Flags{}, // flags
73+
DartDeferredLoadHandler::empty_dart_deferred_load_handler,
9274
settings.isolate_create_callback, // isolate create callback
9375
settings.isolate_shutdown_callback, // isolate shutdown callback,
9476
entrypoint, // dart entrypoint

runtime/runtime_controller.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,6 @@ void RuntimeController::CompleteDartLoadLibrary(
461461
for (std::string paths : searchPaths) {
462462
FML_LOG(ERROR) << " " << paths;
463463
}
464-
// FML_LOG(ERROR) << "Opening lib \"" << lib_name
465-
// << "\" failed: " + std::string(::dlerror());
466464
return;
467465
}
468466

shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ public FlutterEngine(
277277
assetManager = context.getAssets();
278278
}
279279
this.dartExecutor = new DartExecutor(flutterJNI, assetManager);
280-
281280
this.dartExecutor.onAttachedToJNI();
282281

283282
accessibilityChannel = new AccessibilityChannel(dartExecutor, flutterJNI);
@@ -294,7 +293,6 @@ public FlutterEngine(
294293

295294
this.localizationPlugin = new LocalizationPlugin(context, localizationChannel);
296295

297-
298296
this.flutterJNI = flutterJNI;
299297
dynamicFeatureManager = new PlayStoreDynamicFeatureManager(context, flutterJNI);
300298
if (flutterLoader == null) {

shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import android.os.Bundle;
1212
import android.security.NetworkSecurityPolicy;
1313
import androidx.annotation.NonNull;
14-
import io.flutter.Log;
1514
import java.io.IOException;
1615
import org.json.JSONArray;
1716
import org.xmlpull.v1.XmlPullParserException;
@@ -143,6 +142,7 @@ public static FlutterApplicationInfo load(@NonNull Context applicationContext) {
143142
if (android.os.Build.VERSION.SDK_INT >= 23) {
144143
clearTextPermitted = NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted();
145144
}
145+
146146
return new FlutterApplicationInfo(
147147
getString(appInfo.metaData, PUBLIC_AOT_SHARED_LIBRARY_NAME),
148148
getString(appInfo.metaData, PUBLIC_VM_SNAPSHOT_DATA_KEY),

shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void run() {
143143
if (resourceExtractor != null) {
144144
resourceExtractor.waitForCompletion();
145145
}
146-
Log.e("flutter", "PATHS: " + PathUtils.getFilesDir(appContext) + "|" + PathUtils.getCacheDirectory(appContext) + "|" + PathUtils.getDataDirectory(appContext));
146+
147147
return new InitResult(
148148
PathUtils.getFilesDir(appContext),
149149
PathUtils.getCacheDirectory(appContext),

testing/dart_isolate_runner.cc

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,6 @@ std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolateOnUITaskRunner(
7171
}
7272

7373
auto settings = p_settings;
74-
auto weak_isolate = DartIsolate::CreateRootIsolate(
75-
vm_data->GetSettings(), // settings
76-
vm_data->GetIsolateSnapshot(), // isolate snapshot
77-
std::move(task_runners), // task runners
78-
nullptr, // window
79-
{}, // snapshot delegate
80-
{}, // hint freed delegate
81-
io_manager, // io manager
82-
{}, // unref queue
83-
{}, // image decoder
84-
"main.dart", // advisory uri
85-
"main", // advisory entrypoint
86-
nullptr, // flags
87-
DartDeferredLoadHandler::empty_dart_deferred_load_handler,
88-
settings.isolate_create_callback, // isolate create callback
89-
settings.isolate_shutdown_callback // isolate shutdown callback
90-
);
91-
92-
auto root_isolate = std::make_unique<AutoIsolateShutdown>(
93-
weak_isolate.lock(), task_runners.GetUITaskRunner());
94-
95-
if (!root_isolate->IsValid()) {
96-
FML_LOG(ERROR) << "Could not create isolate.";
97-
return;
98-
}
9974

10075
settings.dart_entrypoint_args = args;
10176

@@ -136,18 +111,19 @@ std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolateOnUITaskRunner(
136111

137112
auto isolate =
138113
DartIsolate::CreateRunningRootIsolate(
139-
settings, // settings
140-
vm_data->GetIsolateSnapshot(), // isolate snapshot
141-
std::move(task_runners), // task runners
142-
nullptr, // window
143-
{}, // snapshot delegate
144-
{}, // hint freed delegate
145-
io_manager, // io manager
146-
{}, // unref queue
147-
{}, // image decoder
148-
"main.dart", // advisory uri
149-
entrypoint.c_str(), // advisory entrypoint
150-
DartIsolate::Flags{}, // flags
114+
settings, // settings
115+
vm_data->GetIsolateSnapshot(), // isolate snapshot
116+
std::move(task_runners), // task runners
117+
nullptr, // window
118+
{}, // snapshot delegate
119+
{}, // hint freed delegate
120+
io_manager, // io manager
121+
{}, // unref queue
122+
{}, // image decoder
123+
"main.dart", // advisory uri
124+
entrypoint.c_str(), // advisory entrypoint
125+
DartIsolate::Flags{}, // flags
126+
DartDeferredLoadHandler::empty_dart_deferred_load_handler,
151127
settings.isolate_create_callback, // isolate create callback
152128
settings.isolate_shutdown_callback, // isolate shutdown callback
153129
entrypoint, // entrypoint

0 commit comments

Comments
 (0)