Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove Observatory build rules and remaining references from the engine
Work towards dart-lang/sdk#50233
  • Loading branch information
bkonyi committed Jun 3, 2025
commit ffe2f918ab98a4c8a2a1affbbcf11387cc277dbb
6 changes: 0 additions & 6 deletions engine/src/flutter/runtime/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ source_set("runtime") {
"//flutter/third_party/tonic",
"//flutter/txt",
]

if (flutter_runtime_mode != "release" && !is_fuchsia) {
# Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
# instead puts Observatory into the runner's package.
deps += [ "$dart_src/runtime/observatory:embedded_observatory_archive" ]
}
}

if (enable_unittests) {
Expand Down
38 changes: 0 additions & 38 deletions engine/src/flutter/runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,6 @@
#include "third_party/tonic/logging/dart_error.h"
#include "third_party/tonic/typed_data/typed_list.h"

namespace dart {
namespace observatory {

#if !OS_FUCHSIA && !FLUTTER_RELEASE

// These two symbols are defined in |observatory_archive.cc| which is generated
// by the |//third_party/dart/runtime/observatory:archive_observatory| rule.
// Both of these symbols will be part of the data segment and therefore are read
// only.
extern unsigned int observatory_assets_archive_len;
extern const uint8_t* observatory_assets_archive;

#endif // !OS_FUCHSIA && !FLUTTER_RELEASE

} // namespace observatory
} // namespace dart

namespace flutter {

// Arguments passed to the Dart VM in all configurations.
Expand Down Expand Up @@ -158,26 +141,6 @@ bool DartFileModifiedCallback(const char* source_url, int64_t since_ms) {

void ThreadExitCallback() {}

Dart_Handle GetVMServiceAssetsArchiveCallback() {
#if FLUTTER_RELEASE
return nullptr;
#elif OS_FUCHSIA
fml::UniqueFD fd = fml::OpenFile("pkg/data/observatory.tar", false,
fml::FilePermission::kRead);
fml::FileMapping mapping(fd, {fml::FileMapping::Protection::kRead});
if (mapping.GetSize() == 0 || mapping.GetMapping() == nullptr) {
FML_LOG(ERROR) << "Fail to load Observatory archive";
return nullptr;
}
return tonic::DartConverter<tonic::Uint8List>::ToDart(mapping.GetMapping(),
mapping.GetSize());
#else
return tonic::DartConverter<tonic::Uint8List>::ToDart(
::dart::observatory::observatory_assets_archive,
::dart::observatory::observatory_assets_archive_len);
#endif
}

static const char kStdoutStreamId[] = "Stdout";
static const char kStderrStreamId[] = "Stderr";

Expand Down Expand Up @@ -472,7 +435,6 @@ DartVM::DartVM(const std::shared_ptr<const DartVMData>& vm_data,
params.file_write = dart::bin::WriteFile;
params.file_close = dart::bin::CloseFile;
params.entropy_source = dart::bin::GetEntropy;
params.get_service_assets = GetVMServiceAssetsArchiveCallback;
DartVMInitializer::Initialize(&params,
settings_.enable_timeline_event_handler,
settings_.trace_systrace);
Expand Down
17 changes: 1 addition & 16 deletions engine/src/flutter/shell/platform/fuchsia/dart_runner/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ template("aot_runner_package") {
deps += [
"vmservice:vmservice_snapshot",
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:dart_aot_runner",

# TODO(kaushikiska): Figure out how to get the profiler symbols for `libdart_aotruntime`
# "$dart_src/runtime:libdart_aotruntime",
observatory_target,
]
}

Expand All @@ -195,10 +191,6 @@ template("aot_runner_package") {
path = vmservice_snapshot
dest = "vmservice_snapshot.so"
},
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = dart_profiler_symbols
dest = "dart_aot_runner.dartprofilersymbols"
Expand All @@ -222,10 +214,7 @@ template("jit_runner_package") {
]

if (!invoker.product) {
deps += [
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:dart_jit_runner",
observatory_target,
]
deps += [ "//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:dart_jit_runner" ]
}

binary = "dart_jit${product_suffix}_runner"
Expand All @@ -247,10 +236,6 @@ template("jit_runner_package") {

if (!invoker.product) {
resources += [
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = rebase_path(
get_label_info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ DartRunner::DartRunner(sys::ComponentContext* context) : context_(context) {
params.shutdown_isolate = IsolateShutdownCallback;
params.cleanup_group = IsolateGroupCleanupCallback;
params.entropy_source = EntropySource;
#if !defined(DART_PRODUCT)
params.get_service_assets = GetVMServiceAssetsArchiveCallback;
#endif
error = Dart_Initialize(&params);
if (error)
FML_LOG(FATAL) << "Dart_Initialize failed: " << error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,4 @@ Dart_Isolate CreateServiceIsolate(
return isolate;
} // namespace dart_runner

Dart_Handle GetVMServiceAssetsArchiveCallback() {
dart_utils::MappedResource vm_service_tar;
if (!dart_utils::MappedResource::LoadFromNamespace(
nullptr, "/pkg/data/observatory.tar", vm_service_tar)) {
FML_LOG(ERROR) << "Failed to load Observatory assets";
return nullptr;
}
// TODO(rmacnak): Should we avoid copying the tar? Or does the service
// library not hold onto it anyway?
return tonic::DartConverter<tonic::Uint8List>::ToDart(
reinterpret_cast<const uint8_t*>(vm_service_tar.address()),
vm_service_tar.size());
}

} // namespace dart_runner
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Dart_Isolate CreateServiceIsolate(const char* uri,
Dart_IsolateFlags* flags,
char** error);

Dart_Handle GetVMServiceAssetsArchiveCallback();

} // namespace dart_runner

#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DART_RUNNER_SERVICE_ISOLATE_H_
18 changes: 2 additions & 16 deletions engine/src/flutter/shell/platform/fuchsia/flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,7 @@ template("jit_runner") {
]

if (!product) {
deps += [
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_jit_runner",
observatory_target,
]
deps += [ "//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_jit_runner" ]
}

binary = "flutter_jit${product_suffix}_runner"
Expand All @@ -329,10 +326,6 @@ template("jit_runner") {

if (!product) {
resources += [
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = rebase_path(
get_label_info(
Expand Down Expand Up @@ -381,10 +374,7 @@ template("aot_runner") {
deps = [ ":aot${product_suffix}" ]

if (!product) {
deps += [
"//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_aot_runner",
observatory_target,
]
deps += [ "//flutter/shell/platform/fuchsia/runtime/dart/profiler_symbols:flutter_aot_runner" ]
}

binary = "flutter_aot${product_suffix}_runner"
Expand All @@ -398,10 +388,6 @@ template("aot_runner") {

if (!product) {
resources += [
{
path = rebase_path(observatory_archive_file)
dest = "observatory.tar"
},
{
path = rebase_path(
get_label_info(
Expand Down
2 changes: 1 addition & 1 deletion engine/src/flutter/testing/dart/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ foreach(test, tests) {

group("dart") {
testonly = true
deps = [ "//flutter/testing/dart/observatory" ]
deps = [ "//flutter/testing/dart/vm_service" ]
foreach(test, tests) {
deps += [ ":compile_$test" ]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ foreach(test, tests) {
}
}

group("observatory") {
group("vm_service") {
testonly = true
deps = []
foreach(test, tests) {
Expand Down
6 changes: 0 additions & 6 deletions engine/src/flutter/tools/fuchsia/dart.gni
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ gen_snapshot = "$dart_src/runtime/bin:gen_snapshot"
gen_snapshot_product = "$dart_src/runtime/bin:gen_snapshot_product"

prebuilt_dart = "$dart_src/tools/sdks/dart-sdk/bin/dart"

observatory_target = "$dart_src/runtime/observatory:observatory_archive"
observatory_archive_dir = get_label_info(observatory_target, "target_gen_dir")
observatory_archive_name = get_label_info(observatory_target, "name")
observatory_archive_file =
"${observatory_archive_dir}/${observatory_archive_name}.tar"
11 changes: 0 additions & 11 deletions engine/src/flutter/tools/licenses/lib/patterns.dart
Original file line number Diff line number Diff line change
Expand Up @@ -718,17 +718,6 @@ final List<LicenseReferencePattern> csReferencesByIdentifyingReference = <Licens
),
),

// Observatory (polymer)
LicenseReferencePattern(
checkLocalFirst: false,
pattern: RegExp(
kIndent +
r'This code may only be used under the BSD style license found at (http://polymer.github.io/LICENSE.txt)$',
multiLine: true,
caseSensitive: false,
),
),

// LLVM (Apache License v2.0 with LLVM Exceptions)
LicenseReferencePattern(
checkLocalFirst: false,
Expand Down
Loading