Fix RunBundleAndSource to run from kernel. (flutter/engine#4184)
* Fix RunBundleAndSource to run from kernel. This is needed to accommodate restarting(rather than reload) of Flutter app from kernel. * Fix formatting
This commit is contained in:
committed by
GitHub
parent
adaa3a0303
commit
948a60c83d
@@ -234,11 +234,23 @@ void Engine::RunBundleAndSource(const std::string& bundle_path,
|
||||
std::string packages_path = packages;
|
||||
if (packages_path.empty())
|
||||
packages_path = FindPackagesPath(main);
|
||||
if (!bundle_path.empty())
|
||||
ConfigureAssetBundle(bundle_path);
|
||||
ConfigureRuntime(GetScriptUriFromPath(main));
|
||||
load_script_error_ =
|
||||
runtime_->dart_controller()->RunFromSource(main, packages_path);
|
||||
|
||||
std::vector<uint8_t> platform_kernel;
|
||||
if (!bundle_path.empty()) {
|
||||
GetAssetAsBuffer(blink::kPlatformKernelAssetKey, &platform_kernel);
|
||||
}
|
||||
ConfigureRuntime(GetScriptUriFromPath(bundle_path), platform_kernel);
|
||||
|
||||
if (!platform_kernel.empty()) {
|
||||
std::vector<uint8_t> kernel;
|
||||
if (!files::ReadFileToVector(main, &kernel)) {
|
||||
load_script_error_ = tonic::kUnknownErrorType;
|
||||
}
|
||||
load_script_error_ = runtime_->dart_controller()->RunFromKernel(kernel);
|
||||
} else {
|
||||
load_script_error_ =
|
||||
runtime_->dart_controller()->RunFromSource(main, packages_path);
|
||||
}
|
||||
}
|
||||
|
||||
void Engine::BeginFrame(fxl::TimePoint frame_time) {
|
||||
|
||||
Reference in New Issue
Block a user