592e5c144a
This CL introduces an `IsolateData::asset_base_path` which contains the fully resolved base path used for assets which are loaded with a relative path. (Resolving both PATHEXT and symlinks.) The asset base path is now only resolved once, instead of on every relative asset load. The asset base path is now eagerly resolved. To prevent existing error messages for files not existing changing in `dartdev` and `Isolate.spawnUri`, files not existing errors are ignored. To prevent `tests/standalone/io/named_pipe_script_test.dart` from failing, failing to canonicalize a file path is treated as no asset base path rather than reporting a failure. TEST=pkg/dartdev/test/native_assets/*.dart Bug: https://github.com/dart-lang/sdk/issues/60946 Change-Id: I79a9144d220dfb3e54311725d41f8f91c88db3a1 Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-win-release-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-android-release-arm64c-try,vm-aot-linux-debug-x64-try,vm-aot-mac-debug-arm64-try,vm-aot-win-debug-arm64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-msan-linux-release-x64-try,vm-asan-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435421 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "bin/isolate_data.h"
|
|
#include "bin/snapshot_utils.h"
|
|
#include "platform/growable_array.h"
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
IsolateGroupData::IsolateGroupData(const char* url,
|
|
const char* asset_resolution_base,
|
|
const char* packages_file,
|
|
AppSnapshot* app_snapshot,
|
|
bool isolate_run_app_snapshot)
|
|
: script_url((url != nullptr) ? Utils::StrDup(url) : nullptr),
|
|
asset_resolution_base((asset_resolution_base != nullptr)
|
|
? Utils::StrDup(asset_resolution_base)
|
|
: nullptr),
|
|
app_snapshot_(app_snapshot),
|
|
resolved_packages_config_(nullptr),
|
|
kernel_buffer_(nullptr),
|
|
kernel_buffer_size_(0),
|
|
isolate_run_app_snapshot_(isolate_run_app_snapshot) {
|
|
if (packages_file != nullptr) {
|
|
packages_file_ = Utils::StrDup(packages_file);
|
|
}
|
|
}
|
|
|
|
IsolateGroupData::~IsolateGroupData() {
|
|
for (intptr_t i = 0; i < loading_units_.length(); i++) {
|
|
delete loading_units_[i];
|
|
}
|
|
free(script_url);
|
|
free(asset_resolution_base);
|
|
script_url = nullptr;
|
|
free(packages_file_);
|
|
packages_file_ = nullptr;
|
|
free(resolved_packages_config_);
|
|
resolved_packages_config_ = nullptr;
|
|
kernel_buffer_ = nullptr;
|
|
kernel_buffer_size_ = 0;
|
|
}
|
|
|
|
IsolateData::IsolateData(IsolateGroupData* isolate_group_data)
|
|
: isolate_group_data_(isolate_group_data),
|
|
loader_(nullptr),
|
|
packages_file_(nullptr) {
|
|
if (isolate_group_data->packages_file_ != nullptr) {
|
|
packages_file_ = Utils::StrDup(isolate_group_data->packages_file_);
|
|
}
|
|
}
|
|
|
|
IsolateData::~IsolateData() {
|
|
free(packages_file_);
|
|
packages_file_ = nullptr;
|
|
}
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|