|
8 | 8 | #include <utility> |
9 | 9 |
|
10 | 10 | #include "flutter/fml/command_line.h" |
| 11 | +#include "flutter/fml/native_library.h" |
11 | 12 | #include "flutter/fml/synchronization/waitable_event.h" |
| 13 | +#include "flutter/runtime/dart_snapshot.h" |
12 | 14 | #include "flutter/shell/common/shell_io_manager.h" |
13 | 15 | #include "flutter/shell/common/switches.h" |
14 | 16 | #include "flutter/shell/gpu/gpu_surface_gl_delegate.h" |
@@ -335,38 +337,60 @@ Dart_Handle PlatformViewAndroid::OnDartLoadLibrary(intptr_t loading_unit_id) { |
335 | 337 | Dart_Handle PlatformViewAndroid::CompleteDartLoadLibrary( |
336 | 338 | intptr_t loading_unit_id, |
337 | 339 | std::string lib_name) { |
338 | | - std::vector<std::string> args; |
339 | | - args.push_back("flutter"); |
340 | | - args.push_back("--aot-shared-library-name=" + lib_name); |
341 | | - // args.push_back("--" + "aot-shared-library-name" + "=" + |
342 | | - // fml::jni::JavaStringToString(env, jLibPath)); |
343 | | - // shellArgs.add( |
344 | | - // "--" + AOT_SHARED_LIBRARY_NAME + "=" + |
345 | | - // flutterApplicationInfo.aotSharedLibraryName); |
346 | | - |
347 | | - // // Most devices can load the AOT shared library based on the library name |
348 | | - // // with no directory path. Provide a fully qualified path to the library |
349 | | - // // as a workaround for devices where that fails. |
350 | | - // shellArgs.add( |
351 | | - // "--" |
352 | | - // + AOT_SHARED_LIBRARY_NAME |
353 | | - // + "=" |
354 | | - // + flutterApplicationInfo.nativeLibraryDir |
355 | | - // + File.separator |
356 | | - // + flutterApplicationInfo.aotSharedLibraryName); |
357 | | - auto command_line = fml::CommandLineFromIterators(args.begin(), args.end()); |
358 | | - |
359 | | - auto settings = SettingsFromCommandLine(command_line); |
360 | | - |
361 | | - fml::RefPtr<DartSnapshot> isolateSnapshot = |
362 | | - DartSnapshot::IsolateSnapshotFromSettings(settings); |
363 | | - |
364 | | - // ANDROID_SHELL_HOLDER->Launch(std::move(config)); |
365 | | - |
366 | | - Dart_Handle result = Dart_DeferredLoadComplete( |
367 | | - loading_unit_id, isolateSnapshot->GetDataMapping(), |
368 | | - isolateSnapshot->GetInstructionsMapping()); |
| 340 | + FML_LOG(ERROR) << "COMPLETING"; |
| 341 | + fml::RefPtr<fml::NativeLibrary> native_lib = |
| 342 | + fml::NativeLibrary::Create(lib_name.c_str()); |
| 343 | + const uint8_t* isolate_data = |
| 344 | + native_lib->ResolveSymbol(DartSnapshot::kIsolateDataSymbol); |
| 345 | + FML_LOG(ERROR) << "COMPLETING " << isolate_data; |
| 346 | + const uint8_t* isolate_instructions = |
| 347 | + native_lib->ResolveSymbol(DartSnapshot::kIsolateInstructionsSymbol); |
| 348 | + FML_LOG(ERROR) << "COMPLETING " << isolate_instructions; |
| 349 | + |
| 350 | + Dart_Handle result = Dart_DeferredLoadComplete(loading_unit_id, isolate_data, |
| 351 | + isolate_instructions); |
| 352 | + FML_LOG(ERROR) << "COMPLETING " << result; |
369 | 353 | return result; |
| 354 | + |
| 355 | + // std::vector<std::string> args; |
| 356 | + // args.push_back("flutter"); |
| 357 | + // args.push_back("--aot-shared-library-name=" + lib_name); |
| 358 | + // // args.push_back("--" + "aot-shared-library-name" + "=" + |
| 359 | + // // fml::jni::JavaStringToString(env, jLibPath)); |
| 360 | + // // shellArgs.add( |
| 361 | + // // "--" + AOT_SHARED_LIBRARY_NAME + "=" + |
| 362 | + // // flutterApplicationInfo.aotSharedLibraryName); |
| 363 | + |
| 364 | + // // // Most devices can load the AOT shared library based on the library |
| 365 | + // name |
| 366 | + // // // with no directory path. Provide a fully qualified path to the |
| 367 | + // library |
| 368 | + // // // as a workaround for devices where that fails. |
| 369 | + // // shellArgs.add( |
| 370 | + // // "--" |
| 371 | + // // + AOT_SHARED_LIBRARY_NAME |
| 372 | + // // + "=" |
| 373 | + // // + flutterApplicationInfo.nativeLibraryDir |
| 374 | + // // + File.separator |
| 375 | + // // + flutterApplicationInfo.aotSharedLibraryName); |
| 376 | + // auto command_line = fml::CommandLineFromIterators(args.begin(), |
| 377 | + // args.end()); |
| 378 | + |
| 379 | + // auto settings = SettingsFromCommandLine(command_line); |
| 380 | + |
| 381 | + // for (std::string str : settings.application_library_path) { |
| 382 | + // FML_LOG(ERROR) << "LIBNAME: " << str; |
| 383 | + // } |
| 384 | + |
| 385 | + // fml::RefPtr<DartSnapshot> isolateSnapshot = |
| 386 | + // DartSnapshot::IsolateSnapshotFromSettings(settings); |
| 387 | + |
| 388 | + // // ANDROID_SHELL_HOLDER->Launch(std::move(config)); |
| 389 | + |
| 390 | + // Dart_Handle result = Dart_DeferredLoadComplete( |
| 391 | + // loading_unit_id, isolateSnapshot->GetDataMapping(), |
| 392 | + // isolateSnapshot->GetInstructionsMapping()); |
| 393 | + // return result; |
370 | 394 | } |
371 | 395 |
|
372 | 396 | void PlatformViewAndroid::InstallFirstFrameCallback() { |
|
0 commit comments