[ Observatory ] Remove Observatory from the Dart VM

Also cleans up some references to Observatory in various places.

Work towards https://github.com/dart-lang/sdk/issues/50233

TEST=N/A
CoreLibraryReviewExempt: Not modifying public core libraries.
Change-Id: I1f36b4e6f1fd9a59a579d719aafa599906eedb3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429141
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ben Konyi
2025-06-11 15:19:55 -07:00
committed by Commit Queue
parent d9c681e748
commit 60b217ff2d
34 changed files with 29 additions and 1209 deletions
-12
View File
@@ -218,18 +218,6 @@ group("dart2js_bot") {
]
}
# This rule and the compressed_observatory_archive rule are for the Fuchsia
# bots that pre-build the Observatory. They copy the observatory tar files to
# the root build output directory for convenient access by the Fuchsia buildbot
# scripts.
group("observatory_archive") {
deps = [ "runtime/observatory:copy_observatory_archive" ]
}
group("compressed_observatory_archive") {
deps = [ "runtime/observatory:copy_compressed_observatory_archive" ]
}
if (is_fuchsia) {
import("third_party/fuchsia/gn-sdk/src/component.gni")
import("third_party/fuchsia/gn-sdk/src/package.gni")
@@ -225,7 +225,7 @@ class LspAnalysisServerMemoryUsageTest
_vmServicePort = await ServiceProtocol._findAvailableSocketPort();
vmArgs.addAll([
'--enable-vm-service=$_vmServicePort',
'-DSILENT_OBSERVATORY=true',
'-DSILENT_VM_SERVICE=true',
'--disable-service-auth-codes',
'--disable-dart-dev',
'--no-dds',
@@ -716,7 +716,7 @@ class Server {
}
/// Start the server. If [profileServer] is `true`, the server will be started
/// with "--observe" and "--pause-isolates-on-exit", allowing the observatory
/// with "--observe" and "--pause-isolates-on-exit", allowing Dart DevTools
/// to be used.
Future<void> start({
required String dartSdkPath,
@@ -601,7 +601,7 @@ class Server {
/// the specified port.
///
/// If [profileServer] is `true`, the server will be started with "--observe"
/// and "--pause-isolates-on-exit", allowing the observatory to be used.
/// and "--pause-isolates-on-exit", allowing Dart DevTools to be used.
///
/// If [useAnalysisHighlight2] is `true`, the server will use the new
/// highlight APIs.
@@ -49,15 +49,12 @@ that will be written to the instrumentation log file. Currently, the best choice
for this is the `plugin.error` notification. Just be sure that `isFatal` has a
value of `false`.
## Using Observatory
## Using Dart DevTools
If the client you're using allows you to pass command-line flags to the VM, then
you can also run the analysis server under the Observatory. Pass in both
you can also run the analysis server under Dart DevTools. Pass in both
`--observe` and `--pause-isolates-on-start`, then point your browser to
`http://localhost:8181`. To learn more, see the
[observatory][observatory] documentation.
`http://localhost:8181`.
If you're using IntelliJ as your client, open the "Registry..." dialog and edit
the entry named "dart.server.vm.options".
[observatory]: https://dart-lang.github.io/observatory/
+1 -1
View File
@@ -367,7 +367,7 @@ functionality is publicly exposed.
when run on very large apps.
* `tool/dart2js_stress.dart` and `tool/dart2js_profile_many.dart`: other
helper wrappers to make it easier to profile dart2js with Observatory.
helper wrappers to make it easier to profile dart2js with Dart DevTools.
* Source map tracking (`lib/src/io`): helpers used to track source information
and to build source map files. _TODO: add details_.
+1 -1
View File
@@ -18,7 +18,7 @@ import 'dart:async';
import 'dart:convert';
/// Socket to connect to the vm observatory service.
/// Socket to connect to the VM service.
late WebSocket socket;
Future<void> main(List<String> args) async {
-101
View File
@@ -885,107 +885,6 @@ main() => print('b:b');
);
});
});
group('Observatory', () {
void generateServedTest({
required bool serve,
required bool enableAuthCodes,
required bool explicitRun,
required bool withDds,
}) {
test(
'${serve ? 'served by default' : 'not served'} ${enableAuthCodes ? "with" : "without"} '
'auth codes, ${explicitRun ? 'explicit' : 'implicit'} run,${withDds ? ' ' : 'no'} DDS',
() async {
p = project(
mainSrc:
'void main() { print("ready"); int i = 0; while(true) { i++; } }',
);
Process process = await p.start([
if (explicitRun) 'run',
'--enable-vm-service=0',
if (!withDds) '--no-dds',
if (!enableAuthCodes) '--disable-service-auth-codes',
if (serve) '--serve-observatory',
p.relativeFilePath,
]);
final completer = Completer<void>();
late final StreamSubscription<String> sub;
late final String uri;
sub = process.stdout.transform(utf8.decoder).listen((event) async {
if (event.contains(dartVMServiceRegExp)) {
uri = dartVMServiceRegExp.firstMatch(event)!.group(1)!;
await sub.cancel();
completer.complete();
}
});
// Wait for process to start.
await completer.future;
final client = HttpClient();
Future<String> makeServiceHttpRequest({String method = ''}) async {
var request = await client.getUrl(Uri.parse('$uri$method'));
var response = await request.close();
return await response.transform(utf8.decoder).join();
}
var content = await makeServiceHttpRequest();
const observatoryText = 'Dart VM Observatory';
expect(content.contains(observatoryText), serve);
if (!serve) {
if (withDds) {
expect(content.contains('DevTools'), true);
} else {
expect(
content,
'This VM does not have a registered Dart '
'Development Service (DDS) instance and is not currently serving '
'Dart DevTools.',
);
}
}
// Ensure we can always make VM service requests via HTTP.
content = await makeServiceHttpRequest(method: 'getVM');
expect(content.contains('"jsonrpc":"2.0"'), true);
// If Observatory isn't being served, ensure we can enable it.
if (!serve) {
content = await makeServiceHttpRequest(method: '_serveObservatory');
expect(content.contains('"type":"Success"'), true);
// Ensure Observatory is now being served.
content = await makeServiceHttpRequest();
expect(content.contains(observatoryText), true);
}
process.kill();
},
);
}
const flags = <bool>[true, false];
// TODO(jcollins): Disabling serving no longer seems to produce
// the expected output. Maybe this is because the web interface has
// changed?
for (final serve in [true]) {
for (final enableAuthCodes in flags) {
for (final explicitRun in flags) {
for (final withDds in flags) {
generateServedTest(
serve: serve,
enableAuthCodes: enableAuthCodes,
explicitRun: explicitRun,
withDds: withDds,
);
}
}
}
}
});
}
void residentRun() {
@@ -50,7 +50,7 @@ void main() {
],
);
expect(result.exitCode, 64);
expect(result.stdout, contains('Observatory listening'));
expect(result.stdout, contains('The Dart VM service is listening'));
expect(
result.stderr,
contains(
@@ -100,7 +100,7 @@ void main() {
],
);
expect(result.exitCode, 254);
expect(result.stdout, contains('Observatory listening'));
expect(result.stdout, contains('The Dart VM service is listening'));
expect(
result.stderr,
contains(
@@ -35,7 +35,7 @@ void main() {
defineTest({required bool authCodesEnabled}) {
test(
'Ensure Observatory and DevTools assets are available with '
'Ensure DevTools assets are available with '
'${authCodesEnabled ? '' : 'no'} auth codes', () async {
dds = await DartDevelopmentService.startDartDevelopmentService(
remoteVmServiceUri,
@@ -48,14 +48,6 @@ void main() {
final client = HttpClient();
// Check that Observatory assets are accessible.
final observatoryRequest = await client.getUrl(dds!.uri!);
final observatoryResponse = await observatoryRequest.close();
expect(observatoryResponse.statusCode, 200);
final observatoryContent =
await observatoryResponse.transform(utf8.decoder).join();
expect(observatoryContent, startsWith('<!DOCTYPE html>'));
// Check that DevTools assets are accessible.
final devtoolsRequest = await client.getUrl(dds!.devToolsUri!);
final devtoolsResponse = await devtoolsRequest.close();
-14
View File
@@ -910,9 +910,6 @@ dart_executable("dart") {
"..:libdart_jit",
"../platform:libdart_platform_jit",
]
if (dart_runtime_mode != "release") {
extra_deps += [ "../observatory:standalone_observatory_archive" ]
}
extra_sources = [
"builtin.cc",
"dartdev_isolate.cc",
@@ -926,9 +923,6 @@ dart_executable("dart") {
"main.cc",
"main_impl.cc",
]
if (dart_runtime_mode == "release") {
extra_sources += [ "observatory_assets_empty.cc" ]
}
if (!exclude_kernel_service) {
extra_deps += [ ":dart_kernel_platform_cc" ]
}
@@ -949,9 +943,6 @@ dart_executable("dartaotruntime") {
"..:libdart_aotruntime",
"../platform:libdart_platform_aotruntime",
]
if (dart_runtime_mode != "release") {
extra_deps += [ "../observatory:standalone_observatory_archive" ]
}
extra_sources = [
"builtin.cc",
"gzip.cc",
@@ -974,10 +965,6 @@ dart_executable("dartaotruntime") {
":shared_object_loaders",
]
}
if (dart_runtime_mode == "release") {
extra_sources += [ "observatory_assets_empty.cc" ]
}
}
dart_executable("dartaotruntime_product") {
@@ -998,7 +985,6 @@ dart_executable("dartaotruntime_product") {
"loader.h",
"main.cc",
"main_impl.cc",
"observatory_assets_empty.cc",
"snapshot_empty.cc",
]
-22
View File
@@ -1117,27 +1117,6 @@ static bool CheckForInvalidPath(const char* path) {
return true;
}
// Observatory assets are not included in a product build.
#if !defined(PRODUCT)
extern unsigned int observatory_assets_archive_len;
extern const uint8_t* observatory_assets_archive;
Dart_Handle GetVMServiceAssetsArchiveCallback() {
uint8_t* decompressed = nullptr;
intptr_t decompressed_len = 0;
Decompress(observatory_assets_archive, observatory_assets_archive_len,
&decompressed, &decompressed_len);
Dart_Handle tar_file =
DartUtils::MakeUint8Array(decompressed, decompressed_len);
// Free decompressed memory as it has been copied into a Dart array.
free(decompressed);
return tar_file;
}
#else // !defined(PRODUCT)
static Dart_GetVMServiceAssetsArchive GetVMServiceAssetsArchiveCallback =
nullptr;
#endif // !defined(PRODUCT)
void main(int argc, char** argv) {
#if !defined(DART_HOST_OS_WINDOWS)
// Very early so any crashes during startup can also be symbolized.
@@ -1384,7 +1363,6 @@ void main(int argc, char** argv) {
init_params.file_write = DartUtils::WriteFile;
init_params.file_close = DartUtils::CloseFile;
init_params.entropy_source = DartUtils::EntropySource;
init_params.get_service_assets = GetVMServiceAssetsArchiveCallback;
#if !defined(DART_PRECOMPILED_RUNTIME)
init_params.start_kernel_isolate =
dfe.UseDartFrontend() && dfe.CanUseDartFrontend();
+2 -2
View File
@@ -161,7 +161,7 @@ void Options::PrintUsage() {
#if !defined(PRODUCT)
"--observe[=<port>[/<bind-address>]]\n"
" The observe flag is a convenience flag used to run a program with a\n"
" set of options which are often useful for debugging under Observatory.\n"
" set of options which are often useful for debugging under Dart DevTools.\n"
" These options are currently:\n"
" --enable-vm-service[=<port>[/<bind-address>]]\n"
" --serve-devtools\n"
@@ -203,7 +203,7 @@ void Options::PrintUsage() {
#if !defined(PRODUCT)
"--observe[=<port>[/<bind-address>]]\n"
" The observe flag is a convenience flag used to run a program with a\n"
" set of options which are often useful for debugging under Observatory.\n"
" set of options which are often useful for debugging under Dart DevTools.\n"
" These options are currently:\n"
" --enable-vm-service[=<port>[/<bind-address>]]\n"
" --serve-devtools\n"
-18
View File
@@ -1,18 +0,0 @@
// Copyright (c) 2015, 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.
// This file is linked into the dart executable when it does not have
// Observatory baked in.
#include <stdint.h>
namespace dart {
namespace bin {
static const uint8_t observatory_assets_archive_[] = {'\0'};
unsigned int observatory_assets_archive_len = 0;
const uint8_t* observatory_assets_archive = observatory_assets_archive_;
} // namespace bin
} // namespace dart
-4
View File
@@ -221,10 +221,6 @@ bool VmService::Setup(const char* server_ip,
serve_devtools ? Dart_True() : Dart_False());
SHUTDOWN_ON_ERROR(result);
result = Dart_SetField(library, DartUtils::NewString("_serveObservatory"),
serve_observatory ? Dart_True() : Dart_False());
SHUTDOWN_ON_ERROR(result);
result = Dart_SetField(library, DartUtils::NewString("_printDtd"),
print_dtd ? Dart_True() : Dart_False());
SHUTDOWN_ON_ERROR(result);
+2
View File
@@ -930,6 +930,8 @@ typedef struct {
/**
* A function to be called by the service isolate when it requires the
* vmservice assets archive. See Dart_GetVMServiceAssetsArchive.
*
* This field is deprecated and has no effect.
*/
Dart_GetVMServiceAssetsArchive get_service_assets;
-232
View File
@@ -148,238 +148,6 @@ DEFINE_NATIVE_ENTRY(VMService_CancelStream, 0, 1) {
return Object::null();
}
DEFINE_NATIVE_ENTRY(VMService_RequestAssets, 0, 0) {
#ifndef PRODUCT
return Service::RequestAssets();
#else
return Object::null();
#endif
}
#ifndef PRODUCT
// TODO(25041): When reading, this class copies out the filenames and contents
// into new buffers. It does this because the lifetime of |bytes| is uncertain.
// If |bytes| is pinned in memory, then we could instead load up
// |filenames_| and |contents_| with pointers into |bytes| without making
// copies.
class TarArchive {
public:
TarArchive(uint8_t* bytes, intptr_t bytes_length)
: rs_(bytes, bytes_length) {}
void Read() {
while (HasNext()) {
char* filename;
uint8_t* data;
intptr_t data_length;
if (Next(&filename, &data, &data_length)) {
filenames_.Add(filename);
contents_.Add(data);
content_lengths_.Add(data_length);
}
}
}
char* NextFilename() { return filenames_.RemoveLast(); }
uint8_t* NextContent() { return contents_.RemoveLast(); }
intptr_t NextContentLength() { return content_lengths_.RemoveLast(); }
bool HasMore() const { return filenames_.length() > 0; }
intptr_t Length() const { return filenames_.length(); }
private:
enum TarHeaderFields {
kTarHeaderFilenameOffset = 0,
kTarHeaderFilenameSize = 100,
kTarHeaderSizeOffset = 124,
kTarHeaderSizeSize = 12,
kTarHeaderTypeOffset = 156,
kTarHeaderTypeSize = 1,
kTarHeaderSize = 512,
};
enum TarType {
kTarAregType = '\0',
kTarRegType = '0',
kTarLnkType = '1',
kTarSymType = '2',
kTarChrType = '3',
kTarBlkType = '4',
kTarDirType = '5',
kTarFifoType = '6',
kTarContType = '7',
kTarXhdType = 'x',
kTarXglType = 'g',
};
bool HasNext() const { return !EndOfArchive(); }
bool Next(char** filename, uint8_t** data, intptr_t* data_length) {
intptr_t startOfBlock = rs_.Position();
*filename = ReadFilename();
rs_.SetPosition(startOfBlock + kTarHeaderSizeOffset);
intptr_t size = ReadSize();
rs_.SetPosition(startOfBlock + kTarHeaderTypeOffset);
TarType type = ReadType();
SeekToNextBlock(kTarHeaderSize);
if ((type != kTarRegType) && (type != kTarAregType)) {
SkipContents(size);
return false;
}
ReadContents(data, size);
*data_length = size;
return true;
}
void SeekToNextBlock(intptr_t blockSize) {
intptr_t remainder = blockSize - (rs_.Position() % blockSize);
rs_.Advance(remainder);
}
uint8_t PeekByte(intptr_t i) const {
return *(rs_.AddressOfCurrentPosition() + i);
}
bool EndOfArchive() const {
if (rs_.PendingBytes() < (kTarHeaderSize * 2)) {
return true;
}
for (intptr_t i = 0; i < (kTarHeaderSize * 2); i++) {
if (PeekByte(i) != 0) {
return false;
}
}
return true;
}
TarType ReadType() {
return static_cast<TarType>(ReadStream::Raw<1, uint8_t>::Read(&rs_));
}
void SkipContents(intptr_t size) {
rs_.Advance(size);
SeekToNextBlock(kTarHeaderSize);
}
intptr_t ReadCString(char** s, intptr_t length) {
intptr_t to_read = Utils::Minimum(length, rs_.PendingBytes());
char* result = new char[to_read + 1];
strncpy(result,
reinterpret_cast<const char*>(rs_.AddressOfCurrentPosition()),
to_read);
result[to_read] = '\0';
rs_.SetPosition(rs_.Position() + to_read);
*s = result;
return to_read;
}
intptr_t ReadSize() {
char* octalSize;
unsigned int size;
ReadCString(&octalSize, kTarHeaderSizeSize);
int result = sscanf(octalSize, "%o", &size);
delete[] octalSize;
if (result != 1) {
return 0;
}
return size;
}
char* ReadFilename() {
char* result;
intptr_t result_length = ReadCString(&result, kTarHeaderFilenameSize);
if (result[0] == '/') {
return result;
}
char* fixed_result = new char[result_length + 2]; // '/' + '\0'.
fixed_result[0] = '/';
strncpy(&fixed_result[1], result, result_length);
fixed_result[result_length + 1] = '\0';
delete[] result;
return fixed_result;
}
void ReadContents(uint8_t** data, intptr_t size) {
uint8_t* result = new uint8_t[size];
rs_.ReadBytes(result, size);
SeekToNextBlock(kTarHeaderSize);
*data = result;
}
ReadStream rs_;
GrowableArray<char*> filenames_;
GrowableArray<uint8_t*> contents_;
GrowableArray<intptr_t> content_lengths_;
DISALLOW_COPY_AND_ASSIGN(TarArchive);
};
static void ContentsFinalizer(void* isolate_callback_data, void* peer) {
uint8_t* data = reinterpret_cast<uint8_t*>(peer);
delete[] data;
}
#endif
DEFINE_NATIVE_ENTRY(VMService_DecodeAssets, 0, 1) {
#ifndef PRODUCT
GET_NON_NULL_NATIVE_ARGUMENT(TypedData, data, arguments->NativeArgAt(0));
Api::Scope scope(thread);
Dart_Handle data_handle = Api::NewHandle(thread, data.ptr());
Dart_Handle result_list;
{
TransitionVMToNative transition(thread);
Dart_TypedData_Type typ;
void* bytes;
intptr_t length;
Dart_Handle err =
Dart_TypedDataAcquireData(data_handle, &typ, &bytes, &length);
ASSERT(!Dart_IsError(err));
TarArchive archive(reinterpret_cast<uint8_t*>(bytes), length);
archive.Read();
err = Dart_TypedDataReleaseData(data_handle);
ASSERT(!Dart_IsError(err));
intptr_t archive_size = archive.Length();
result_list = Dart_NewList(2 * archive_size);
ASSERT(!Dart_IsError(result_list));
intptr_t idx = 0;
while (archive.HasMore()) {
char* filename = archive.NextFilename();
intptr_t filename_length = strlen(filename);
uint8_t* contents = archive.NextContent();
intptr_t contents_length = archive.NextContentLength();
Dart_Handle dart_filename = Dart_NewStringFromUTF8(
reinterpret_cast<uint8_t*>(filename), filename_length);
ASSERT(!Dart_IsError(dart_filename));
Dart_Handle dart_contents = Dart_NewExternalTypedDataWithFinalizer(
Dart_TypedData_kUint8, contents, contents_length, contents,
contents_length, ContentsFinalizer);
ASSERT(!Dart_IsError(dart_contents));
Dart_ListSetAt(result_list, idx, dart_filename);
Dart_ListSetAt(result_list, (idx + 1), dart_contents);
idx += 2;
}
}
return Api::UnwrapArrayHandle(thread->zone(), result_list).ptr();
#else
return Object::null();
#endif
}
#ifndef PRODUCT
class UserTagIsolatesVisitor : public IsolateVisitor {
public:
-266
View File
@@ -1,266 +0,0 @@
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../build/dart/copy_tree.gni")
import("../../build/dart/dart_action.gni")
import("observatory_sources.gni")
prebuilt_dartaotruntime_action("build_observatory") {
visibility = [ ":copy_main_dart_js" ]
# dart2js produces a .deps file, but it is not in a format that is understood
# by ninja, so we explicitly list all the sources here.
inputs = [ "../../.dart_tool/package_config.json" ] + observatory_sources
output = "$target_gen_dir/observatory/web/main.dart.js"
outputs = [ output ]
if (is_debug) {
outputs += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
}
args = [
rebase_path(
"../../tools/sdks/dart-sdk/bin/snapshots/dart2js_aot.dart.snapshot",
root_build_dir),
"--invoker=dart_cli",
"-o",
rebase_path(output, root_build_dir),
"--packages=" +
rebase_path("../../.dart_tool/package_config.json", root_build_dir),
rebase_path("web/main.dart", root_build_dir),
]
if (is_debug) {
args += [ "--enable-asserts" ]
} else {
args += [ "--minify" ]
}
}
# The rules here down to "deploy_observatory" copy files into place such that
# they can be packaged into a tar file. These rules do the following copies:
#
# web/* ->
# $target_out_dir/observatory/deployed/web
# $target_gen_dir/observatory/web/main.dart.js ->
# $target_out_dir/observatory/deployed/web/main.dart.js
# ../../third_party/observatory_pub_packages/packages/$PACKAGE/lib/* ->
# $target_out_dir/observatory/deployed/web/packages/$PACKAGE
# lib/* ->
# $target_out_dir/observatory/deployed/web/packages/observatory
#
# Files matching "observatory_ignore_patterns" are excluded.
# Files matching these patterns are filtered out of the Observatory assets.
observatory_ignore_patterns = [
# "\$sdk", this is the first element concatenated into the string below.
"*.concat.js",
"*.dart",
"*.log",
"*.precompiled.js",
"*.scriptUrls",
"*_buildLogs*",
"*~",
"CustomElements.*",
"HTMLImports.*",
"MutationObserver.*",
"ShadowDOM.*",
"bower.json",
"dart_support.*",
"interop_support.*",
"package.json",
"unittest*",
]
if (!is_debug) {
observatory_ignore_patterns += [ "*.map" ]
}
# The ignore_patterns entry in the scopes accepted by copy_tree() is a
# string of comma delimited patterns.
observatory_ignore_string = "\$sdk"
foreach(pattern, observatory_ignore_patterns) {
observatory_ignore_string = "$observatory_ignore_string,$pattern"
}
copy_tree("copy_web_package") {
visibility = [
":copy_observatory_package",
":deploy_observatory",
]
source = "web"
dest = "$target_out_dir/observatory/deployed/web"
exclude = observatory_ignore_string
}
copy_tree("copy_observatory_package") {
visibility = [
":copy_main_dart_js",
":deploy_observatory",
]
source = "lib"
dest = "$target_out_dir/observatory/deployed/web/packages/observatory"
exclude = observatory_ignore_string
# This deps prevents this copy and copy_web_package from racing on the
# creation of the "web" directory.
deps = [ ":copy_web_package" ]
}
copy("copy_main_dart_js") {
visibility = [ ":deploy_observatory" ]
deps = [
":build_observatory",
# This deps prevents this copy from racing with the above copy actions on
# the creation of the "web" directory.
":copy_observatory_package",
]
sources = [ "$target_gen_dir/observatory/web/main.dart.js" ]
if (is_debug) {
sources += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
}
outputs = [ "$target_out_dir/observatory/deployed/web/{{source_file_part}}" ]
}
group("deploy_observatory") {
deps = [
":copy_main_dart_js",
":copy_observatory_package",
":copy_web_package",
]
}
template("observatory_archive") {
enable_compression = false
if (defined(invoker.compress) && invoker.compress) {
enable_compression = true
}
action(target_name) {
deps = [ ":deploy_observatory" ]
output_name = target_name
output = "$target_gen_dir/${output_name}.tar"
outputs = [ output ]
script = "../tools/create_archive.py"
args = [
"--tar_output",
rebase_path(output, root_build_dir),
"--client_root",
rebase_path("$target_out_dir/observatory/deployed/web/", root_build_dir),
]
if (enable_compression) {
args += [ "--compress" ]
}
}
}
observatory_archive("compressed_observatory_archive") {
compress = true
}
copy("copy_compressed_observatory_archive") {
archive_target = ":compressed_observatory_archive"
deps = [ archive_target ]
archive_dir = get_label_info(archive_target, "target_gen_dir")
archive_name = get_label_info(archive_target, "name")
archive_file = "${archive_dir}/${archive_name}.tar"
sources = [ archive_file ]
outputs = [ "$root_out_dir/${archive_name}.tar" ]
}
observatory_archive("observatory_archive") {
compress = false
}
copy("copy_observatory_archive") {
archive_target = ":observatory_archive"
deps = [ archive_target ]
archive_dir = get_label_info(archive_target, "target_gen_dir")
archive_name = get_label_info(archive_target, "name")
archive_file = "${archive_dir}/${archive_name}.tar"
sources = [ archive_file ]
outputs = [ "$root_out_dir/${archive_name}.tar" ]
}
# Generates a .cc file containing the bytes of the observatory archive in a C
# array.
#
# Parameters:
# inner_namespace (required):
# The inner C++ namespace that the C array lives in.
#
# outer_namespace (required):
# The outer C++ namespace that the C array lives in.
#
# archive_file (required):
# The path to the observatory archive.
#
template("observatory_archive_source") {
assert(defined(invoker.inner_namespace),
"Need inner_namespace in $target_name")
assert(defined(invoker.outer_namespace),
"Need outer_namespace in $target_name")
assert(defined(invoker.archive_file), "Need archive_file in $target_name")
action(target_name) {
forward_variables_from(invoker, [ "deps" ])
inputs = [ invoker.archive_file ]
output = "$target_gen_dir/${target_name}.cc"
outputs = [ output ]
script = "../tools/create_archive.py"
args = [
"--tar_input",
rebase_path(invoker.archive_file, root_build_dir),
"--output",
rebase_path(output, root_build_dir),
"--outer_namespace",
invoker.outer_namespace,
"--inner_namespace",
invoker.inner_namespace,
"--name",
"observatory_assets_archive",
]
}
}
observatory_archive_source("embedded_archive_observatory") {
outer_namespace = "dart"
inner_namespace = "observatory"
# TODO(zra): In a Fuchsia build, use a prebuilt Observatory archive.
archive_target = ":observatory_archive"
deps = [ archive_target ]
archive_dir = get_label_info(archive_target, "target_gen_dir")
archive_name = get_label_info(archive_target, "name")
archive_file = "${archive_dir}/${archive_name}.tar"
}
source_set("embedded_observatory_archive") {
deps = [ ":embedded_archive_observatory" ]
sources = [ rebase_path("$target_gen_dir/embedded_archive_observatory.cc") ]
}
observatory_archive_source("standalone_archive_observatory") {
outer_namespace = "dart"
inner_namespace = "bin"
# TODO(zra): In a Fuchsia build, use a prebuilt Observatory archive.
archive_target = ":compressed_observatory_archive"
deps = [ archive_target ]
archive_dir = get_label_info(archive_target, "target_gen_dir")
archive_name = get_label_info(archive_target, "name")
archive_file = "${archive_dir}/${archive_name}.tar"
}
source_set("standalone_observatory_archive") {
deps = [ ":standalone_archive_observatory" ]
sources = [ rebase_path("$target_gen_dir/standalone_archive_observatory.cc") ]
}
-281
View File
@@ -1,281 +0,0 @@
# 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.
# DO NOT EDIT. This file is generated by update_sources.py in this directory.
# This file contains all dart, css, and html sources for Observatory.
observatory_sources = [
"lib/allocation_profile.dart",
"lib/app.dart",
"lib/cli.dart",
"lib/debugger.dart",
"lib/elements.dart",
"lib/event.dart",
"lib/models.dart",
"lib/object_graph.dart",
"lib/repositories.dart",
"lib/sample_profile.dart",
"lib/service.dart",
"lib/service_common.dart",
"lib/service_html.dart",
"lib/service_io.dart",
"lib/src/allocation_profile/allocation_profile.dart",
"lib/src/app/application.dart",
"lib/src/app/location_manager.dart",
"lib/src/app/notification.dart",
"lib/src/app/page.dart",
"lib/src/app/settings.dart",
"lib/src/app/view_model.dart",
"lib/src/cli/command.dart",
"lib/src/debugger/debugger.dart",
"lib/src/debugger/debugger_location.dart",
"lib/src/elements/allocation_profile.dart",
"lib/src/elements/class_allocation_profile.dart",
"lib/src/elements/class_instances.dart",
"lib/src/elements/class_ref.dart",
"lib/src/elements/class_tree.dart",
"lib/src/elements/class_view.dart",
"lib/src/elements/code_ref.dart",
"lib/src/elements/code_view.dart",
"lib/src/elements/containers/search_bar.dart",
"lib/src/elements/containers/virtual_collection.dart",
"lib/src/elements/containers/virtual_tree.dart",
"lib/src/elements/context_ref.dart",
"lib/src/elements/context_view.dart",
"lib/src/elements/cpu_profile.dart",
"lib/src/elements/cpu_profile/virtual_tree.dart",
"lib/src/elements/cpu_profile_table.dart",
"lib/src/elements/css/shared.css",
"lib/src/elements/curly_block.dart",
"lib/src/elements/debugger.dart",
"lib/src/elements/error_ref.dart",
"lib/src/elements/error_view.dart",
"lib/src/elements/eval_box.dart",
"lib/src/elements/field_ref.dart",
"lib/src/elements/field_view.dart",
"lib/src/elements/flag_list.dart",
"lib/src/elements/function_ref.dart",
"lib/src/elements/function_view.dart",
"lib/src/elements/general_error.dart",
"lib/src/elements/heap_map.dart",
"lib/src/elements/heap_snapshot.dart",
"lib/src/elements/helpers/any_ref.dart",
"lib/src/elements/helpers/custom_element.dart",
"lib/src/elements/helpers/element_utils.dart",
"lib/src/elements/helpers/nav_bar.dart",
"lib/src/elements/helpers/nav_menu.dart",
"lib/src/elements/helpers/rendering_queue.dart",
"lib/src/elements/helpers/rendering_scheduler.dart",
"lib/src/elements/helpers/uris.dart",
"lib/src/elements/icdata_ref.dart",
"lib/src/elements/icdata_view.dart",
"lib/src/elements/img/chromium_icon.png",
"lib/src/elements/img/dart_icon.png",
"lib/src/elements/img/isolate_icon.png",
"lib/src/elements/inbound_references.dart",
"lib/src/elements/instance_ref.dart",
"lib/src/elements/instance_view.dart",
"lib/src/elements/isolate/counter_chart.dart",
"lib/src/elements/isolate/location.dart",
"lib/src/elements/isolate/run_state.dart",
"lib/src/elements/isolate/shared_summary.dart",
"lib/src/elements/isolate/summary.dart",
"lib/src/elements/isolate_reconnect.dart",
"lib/src/elements/isolate_ref.dart",
"lib/src/elements/isolate_view.dart",
"lib/src/elements/json_view.dart",
"lib/src/elements/library_ref.dart",
"lib/src/elements/library_view.dart",
"lib/src/elements/local_var_descriptors_ref.dart",
"lib/src/elements/logging.dart",
"lib/src/elements/logging_list.dart",
"lib/src/elements/megamorphiccache_ref.dart",
"lib/src/elements/megamorphiccache_view.dart",
"lib/src/elements/metric/details.dart",
"lib/src/elements/metric/graph.dart",
"lib/src/elements/metrics.dart",
"lib/src/elements/native_memory_profiler.dart",
"lib/src/elements/nav/class_menu.dart",
"lib/src/elements/nav/isolate_menu.dart",
"lib/src/elements/nav/library_menu.dart",
"lib/src/elements/nav/menu_item.dart",
"lib/src/elements/nav/notify.dart",
"lib/src/elements/nav/notify_event.dart",
"lib/src/elements/nav/notify_exception.dart",
"lib/src/elements/nav/refresh.dart",
"lib/src/elements/nav/reload.dart",
"lib/src/elements/nav/top_menu.dart",
"lib/src/elements/nav/vm_menu.dart",
"lib/src/elements/object_common.dart",
"lib/src/elements/object_view.dart",
"lib/src/elements/objectpool_ref.dart",
"lib/src/elements/objectpool_view.dart",
"lib/src/elements/objectstore_view.dart",
"lib/src/elements/observatory_application.dart",
"lib/src/elements/pc_descriptors_ref.dart",
"lib/src/elements/persistent_handles.dart",
"lib/src/elements/ports.dart",
"lib/src/elements/process_snapshot.dart",
"lib/src/elements/retaining_path.dart",
"lib/src/elements/sample_buffer_control.dart",
"lib/src/elements/script_inset.dart",
"lib/src/elements/script_ref.dart",
"lib/src/elements/script_view.dart",
"lib/src/elements/sentinel_value.dart",
"lib/src/elements/sentinel_view.dart",
"lib/src/elements/singletargetcache_ref.dart",
"lib/src/elements/singletargetcache_view.dart",
"lib/src/elements/source_inset.dart",
"lib/src/elements/source_link.dart",
"lib/src/elements/stack_trace_tree_config.dart",
"lib/src/elements/strongly_reachable_instances.dart",
"lib/src/elements/subtypetestcache_ref.dart",
"lib/src/elements/subtypetestcache_view.dart",
"lib/src/elements/timeline_page.dart",
"lib/src/elements/tree_map.dart",
"lib/src/elements/type_arguments_ref.dart",
"lib/src/elements/unknown_ref.dart",
"lib/src/elements/unlinkedcall_ref.dart",
"lib/src/elements/unlinkedcall_view.dart",
"lib/src/elements/vm_connect.dart",
"lib/src/elements/vm_connect_target.dart",
"lib/src/elements/vm_view.dart",
"lib/src/models/exceptions.dart",
"lib/src/models/objects/allocation_profile.dart",
"lib/src/models/objects/breakpoint.dart",
"lib/src/models/objects/class.dart",
"lib/src/models/objects/code.dart",
"lib/src/models/objects/context.dart",
"lib/src/models/objects/error.dart",
"lib/src/models/objects/event.dart",
"lib/src/models/objects/extension_data.dart",
"lib/src/models/objects/field.dart",
"lib/src/models/objects/flag.dart",
"lib/src/models/objects/frame.dart",
"lib/src/models/objects/function.dart",
"lib/src/models/objects/guarded.dart",
"lib/src/models/objects/heap_space.dart",
"lib/src/models/objects/icdata.dart",
"lib/src/models/objects/inbound_references.dart",
"lib/src/models/objects/instance.dart",
"lib/src/models/objects/isolate.dart",
"lib/src/models/objects/isolate_group.dart",
"lib/src/models/objects/library.dart",
"lib/src/models/objects/local_var_descriptors.dart",
"lib/src/models/objects/map_association.dart",
"lib/src/models/objects/megamorphiccache.dart",
"lib/src/models/objects/metric.dart",
"lib/src/models/objects/notification.dart",
"lib/src/models/objects/object.dart",
"lib/src/models/objects/objectpool.dart",
"lib/src/models/objects/objectstore.dart",
"lib/src/models/objects/pc_descriptors.dart",
"lib/src/models/objects/persistent_handles.dart",
"lib/src/models/objects/ports.dart",
"lib/src/models/objects/retaining_path.dart",
"lib/src/models/objects/sample_profile.dart",
"lib/src/models/objects/script.dart",
"lib/src/models/objects/sentinel.dart",
"lib/src/models/objects/service.dart",
"lib/src/models/objects/single_target_cache.dart",
"lib/src/models/objects/source_location.dart",
"lib/src/models/objects/subtype_test_cache.dart",
"lib/src/models/objects/target.dart",
"lib/src/models/objects/timeline.dart",
"lib/src/models/objects/timeline_event.dart",
"lib/src/models/objects/type_arguments.dart",
"lib/src/models/objects/unknown.dart",
"lib/src/models/objects/unlinked_call.dart",
"lib/src/models/objects/vm.dart",
"lib/src/models/repositories/allocation_profile.dart",
"lib/src/models/repositories/breakpoint.dart",
"lib/src/models/repositories/class.dart",
"lib/src/models/repositories/context.dart",
"lib/src/models/repositories/editor.dart",
"lib/src/models/repositories/eval.dart",
"lib/src/models/repositories/event.dart",
"lib/src/models/repositories/field.dart",
"lib/src/models/repositories/flag.dart",
"lib/src/models/repositories/function.dart",
"lib/src/models/repositories/heap_snapshot.dart",
"lib/src/models/repositories/icdata.dart",
"lib/src/models/repositories/inbound_references.dart",
"lib/src/models/repositories/instance.dart",
"lib/src/models/repositories/isolate.dart",
"lib/src/models/repositories/isolate_group.dart",
"lib/src/models/repositories/library.dart",
"lib/src/models/repositories/megamorphiccache.dart",
"lib/src/models/repositories/metric.dart",
"lib/src/models/repositories/notification.dart",
"lib/src/models/repositories/object.dart",
"lib/src/models/repositories/objectpool.dart",
"lib/src/models/repositories/objectstore.dart",
"lib/src/models/repositories/persistent_handles.dart",
"lib/src/models/repositories/ports.dart",
"lib/src/models/repositories/reachable_size.dart",
"lib/src/models/repositories/retained_size.dart",
"lib/src/models/repositories/retaining_path.dart",
"lib/src/models/repositories/sample_profile.dart",
"lib/src/models/repositories/script.dart",
"lib/src/models/repositories/single_target_cache.dart",
"lib/src/models/repositories/strongly_reachable_instances.dart",
"lib/src/models/repositories/subtype_test_cache.dart",
"lib/src/models/repositories/target.dart",
"lib/src/models/repositories/timeline.dart",
"lib/src/models/repositories/type_arguments.dart",
"lib/src/models/repositories/unlinked_call.dart",
"lib/src/models/repositories/vm.dart",
"lib/src/repositories/allocation_profile.dart",
"lib/src/repositories/breakpoint.dart",
"lib/src/repositories/class.dart",
"lib/src/repositories/context.dart",
"lib/src/repositories/editor.dart",
"lib/src/repositories/eval.dart",
"lib/src/repositories/event.dart",
"lib/src/repositories/field.dart",
"lib/src/repositories/flag.dart",
"lib/src/repositories/function.dart",
"lib/src/repositories/heap_snapshot.dart",
"lib/src/repositories/icdata.dart",
"lib/src/repositories/inbound_references.dart",
"lib/src/repositories/instance.dart",
"lib/src/repositories/isolate.dart",
"lib/src/repositories/isolate_group.dart",
"lib/src/repositories/library.dart",
"lib/src/repositories/megamorphiccache.dart",
"lib/src/repositories/metric.dart",
"lib/src/repositories/notification.dart",
"lib/src/repositories/object.dart",
"lib/src/repositories/objectpool.dart",
"lib/src/repositories/objectstore.dart",
"lib/src/repositories/persistent_handles.dart",
"lib/src/repositories/ports.dart",
"lib/src/repositories/reachable_size.dart",
"lib/src/repositories/retained_size.dart",
"lib/src/repositories/retaining_path.dart",
"lib/src/repositories/sample_profile.dart",
"lib/src/repositories/script.dart",
"lib/src/repositories/settings.dart",
"lib/src/repositories/single_target_cache.dart",
"lib/src/repositories/strongly_reachable_instances.dart",
"lib/src/repositories/subtype_test_cache.dart",
"lib/src/repositories/target.dart",
"lib/src/repositories/timeline.dart",
"lib/src/repositories/timeline_base.dart",
"lib/src/repositories/type_arguments.dart",
"lib/src/repositories/unlinked_call.dart",
"lib/src/repositories/vm.dart",
"lib/src/sample_profile/sample_profile.dart",
"lib/src/service/object.dart",
"lib/tracer.dart",
"lib/utils.dart",
"web/favicon.ico",
"web/index.html",
"web/main.dart",
"web/third_party/trace_viewer_full.html",
"web/third_party/webcomponents.min.js",
"web/timeline.html",
"web/timeline.js",
"web/timeline_message_handler.js",
]
-49
View File
@@ -1,49 +0,0 @@
#!/usr/bin/env python3
#
# Copyright (c) 2016, 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.
# Updates the list of Observatory source files.
import os
import sys
from datetime import date
def getDir(rootdir, target):
sources = []
for root, subdirs, files in os.walk(rootdir):
subdirs.sort()
files.sort()
for f in files:
sources.append(root + '/' + f)
return sources
HEADER = """# 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.
# DO NOT EDIT. This file is generated by update_sources.py in this directory.
# This file contains all dart, css, and html sources for Observatory.
"""
def main():
with open('observatory_sources.gni', 'w') as target:
target.write(HEADER)
target.write('observatory_sources = [\n')
sources = []
for rootdir in ['lib', 'web']:
sources.extend(getDir(rootdir, target))
sources.sort()
for s in sources:
if (s[-9:] != 'README.md'):
target.write(' "' + s + '",\n')
target.write(']\n')
if __name__ == "__main__":
main()
-2
View File
@@ -294,8 +294,6 @@ namespace dart {
V(VMService_OnServerAddressChange, 1) \
V(VMService_ListenStream, 2) \
V(VMService_CancelStream, 1) \
V(VMService_RequestAssets, 0) \
V(VMService_DecodeAssets, 1) \
V(VMService_AddUserTagsToStreamableSampleList, 1) \
V(VMService_RemoveUserTagsFromStreamableSampleList, 1) \
V(Ffi_createNativeCallableListener, 2) \
-1
View File
@@ -556,7 +556,6 @@ char* Dart::Init(const Dart_InitializeParams* params) {
// The embedder, not the VM, should trigger creation of the service and kernel
// isolates. https://github.com/dart-lang/sdk/issues/33433
#if !defined(PRODUCT)
Service::SetGetServiceAssetsCallback(params->get_service_assets);
ServiceIsolate::Run();
#endif
+6 -6
View File
@@ -10542,8 +10542,9 @@ static void ReportTimelineEvents() {
Dart_Timeline_Event_Instant, /*argument_count=*/0,
nullptr, nullptr);
Dart_RecordTimelineEvent("T3", 30, /*timestamp1=*/40, /*flow_id_count=*/0,
nullptr, Dart_Timeline_Event_Duration,
Dart_RecordTimelineEvent("T3", 30, /*timestamp1_or_id=*/40,
/*flow_id_count=*/0, nullptr,
Dart_Timeline_Event_Duration,
/*argument_count=*/0, nullptr, nullptr);
Dart_RecordTimelineEvent("T4", 50, 4, /*flow_id_count=*/0, nullptr,
@@ -10593,10 +10594,9 @@ static void ReportTimelineEvents() {
TEST_CASE(DartAPI_TimelineEvents_Serialization) {
// We do not check the contents of the JSON output here because we have
// pkg/vm_service/test/get_perfetto_vm_timeline_rpc_test.dart and
// runtime/observatory/tests/get_vm_timeline_rpc_test.dart for that. This test
// is used to ensure that assertions in timeline code are checked by debug
// tryjobs, and that the sanitizers run on the timeline code.
// pkg/vm_service/test/get_perfetto_vm_timeline_rpc_test.dart for that.
// This test is used to ensure that assertions in timeline code are checked
// by debug tryjobs, and that the sanitizers run on the timeline code.
// Grab embedder stream.
TimelineStream* stream = Timeline::GetEmbedderStream();
-1
View File
@@ -3782,7 +3782,6 @@ void Debugger::PauseDeveloper(const String& msg) {
DebuggerStackTrace* stack_trace = DebuggerStackTrace::Collect();
ASSERT(stack_trace->Length() > 0);
CacheStackTraces(stack_trace, DebuggerStackTrace::CollectAsyncAwaiters());
// TODO(johnmccutchan): Send |msg| to Observatory.
// We are in the native call to Developer_debugger. the developer
// gets a better experience by not seeing this call. To accomplish
+2 -2
View File
@@ -248,7 +248,7 @@ MessageHandler::MessageStatus MessageHandler::HandleMessages(
}
// Remember time since the last message. Don't consider OOB messages so
// using Observatory doesn't trigger additional idle tasks.
// interacting with the VM service doesn't trigger additional idle tasks.
if ((FLAG_idle_timeout_micros != 0) &&
(saved_priority == Message::kNormalPriority)) {
if (idle_time_handler != nullptr) {
@@ -452,7 +452,7 @@ void MessageHandler::TaskCallback() {
if (FLAG_trace_service_pause_events) {
OS::PrintErr(
"Isolate %s paused before exiting. "
"Use the Observatory to release it.\n",
"Use Dart DevTools to release it.\n",
name());
}
remembered_paused_on_exit_status_ = status;
+1 -1
View File
@@ -1274,7 +1274,7 @@ class TypedDataMessageDeserializationCluster
const intptr_t cid_;
};
// This function's name can appear in Observatory.
// This function's name can appear in VM service responses.
static void IsolateMessageTypedDataFinalizer(void* isolate_callback_data,
void* buffer) {
free(buffer);
+1 -1
View File
@@ -27200,7 +27200,7 @@ static void DwarfStackTracesHandler(bool value) {
#if defined(PRODUCT)
// We can safely remove function objects in precompiled snapshots if the
// runtime will generate DWARF stack traces and we don't have runtime
// debugging options like the observatory available.
// debugging options like the VM service available.
if (value) {
FLAG_retain_function_objects = false;
FLAG_retain_code_objects = false;
+1 -48
View File
@@ -262,7 +262,7 @@ class EnumListParameter : public MethodParameter {
}
private:
// For now observatory enums are ascii letters plus underscore.
// For now VM service enums are ascii letters plus underscore.
static bool IsEnumChar(char c) {
return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
(c == '_'));
@@ -474,7 +474,6 @@ const ServiceMethodDescriptor* FindMethod(const char* method_name);
// Support for streams defined in embedders.
Dart_ServiceStreamListenCallback Service::stream_listen_callback_ = nullptr;
Dart_ServiceStreamCancelCallback Service::stream_cancel_callback_ = nullptr;
Dart_GetVMServiceAssetsArchive Service::get_service_assets_callback_ = nullptr;
Dart_EmbedderInformationCallback Service::embedder_information_callback_ =
nullptr;
@@ -544,47 +543,6 @@ void Service::CancelStream(const char* stream_id) {
}
}
ObjectPtr Service::RequestAssets() {
Thread* T = Thread::Current();
Object& object = Object::Handle();
{
Api::Scope api_scope(T);
Dart_Handle handle;
{
TransitionVMToNative transition(T);
if (get_service_assets_callback_ == nullptr) {
return Object::null();
}
handle = get_service_assets_callback_();
if (Dart_IsError(handle)) {
Dart_PropagateError(handle);
}
}
object = Api::UnwrapHandle(handle);
}
if (object.IsNull()) {
return Object::null();
}
if (!object.IsTypedData()) {
const String& error_message = String::Handle(
String::New("An implementation of Dart_GetVMServiceAssetsArchive "
"should return a Uint8Array or null."));
const Error& error = Error::Handle(ApiError::New(error_message));
Exceptions::PropagateError(error);
return Object::null();
}
const TypedData& typed_data = TypedData::Cast(object);
if (typed_data.ElementSizeInBytes() != 1) {
const String& error_message = String::Handle(
String::New("An implementation of Dart_GetVMServiceAssetsArchive "
"should return a Uint8Array or null."));
const Error& error = Error::Handle(ApiError::New(error_message));
Exceptions::PropagateError(error);
return Object::null();
}
return object.ptr();
}
static void PrintSuccess(JSONStream* js) {
JSONObject jsobj(js);
jsobj.AddProperty("type", "Success");
@@ -1496,11 +1454,6 @@ void Service::SetEmbedderStreamCallbacks(
stream_cancel_callback_ = cancel_callback;
}
void Service::SetGetServiceAssetsCallback(
Dart_GetVMServiceAssetsArchive get_service_assets) {
get_service_assets_callback_ = get_service_assets;
}
void Service::SetEmbedderInformationCallback(
Dart_EmbedderInformationCallback callback) {
embedder_information_callback_ = callback;
-6
View File
@@ -156,9 +156,6 @@ class Service : public AllStatic {
Dart_ServiceStreamListenCallback listen_callback,
Dart_ServiceStreamCancelCallback cancel_callback);
static void SetGetServiceAssetsCallback(
Dart_GetVMServiceAssetsArchive get_service_assets);
static void SendEchoEvent(Isolate* isolate, const char* text);
static void SendInspectEvent(Isolate* isolate, const Object& inspectee);
@@ -224,8 +221,6 @@ class Service : public AllStatic {
static bool ListenStream(const char* stream_id, bool include_privates);
static void CancelStream(const char* stream_id);
static ObjectPtr RequestAssets();
static Dart_ServiceStreamListenCallback stream_listen_callback() {
return stream_listen_callback_;
}
@@ -295,7 +290,6 @@ class Service : public AllStatic {
static EmbedderServiceHandler* root_service_handler_head_;
static Dart_ServiceStreamListenCallback stream_listen_callback_;
static Dart_ServiceStreamCancelCallback stream_cancel_callback_;
static Dart_GetVMServiceAssetsArchive get_service_assets_callback_;
static Dart_EmbedderInformationCallback embedder_information_callback_;
static void* service_response_size_log_file_;
+1 -7
View File
@@ -63,9 +63,6 @@ bool _enableServicePortFallback = false;
@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _waitForDdsToAdvertiseService = false;
@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _serveObservatory = false;
@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
bool _printDtd = false;
@@ -129,8 +126,6 @@ Future<Uri> createTempDirCallback(String base) async {
Future<void> deleteDirCallback(Uri path) async =>
await Directory.fromUri(path).delete(recursive: true);
void serveObservatoryCallback() => _serveObservatory = true;
class PendingWrite {
PendingWrite(this.uri, this.bytes);
final completer = Completer<void>();
@@ -237,7 +232,7 @@ Future<void> _toggleWebServer() async {
Future<Uri?> webServerControlCallback(bool enable, bool? silenceOutput) async {
if (silenceOutput != null) {
silentObservatory = silenceOutput;
silentVMService = silenceOutput;
}
if (server.running != enable) {
await _toggleWebServer();
@@ -286,7 +281,6 @@ void main() {
VMServiceEmbedderHooks.webServerControl = webServerControlCallback;
VMServiceEmbedderHooks.acceptNewWebSocketConnections =
webServerAcceptNewWebSocketConnections;
VMServiceEmbedderHooks.serveObservatory = serveObservatoryCallback;
VMServiceEmbedderHooks.getResidentCompilerInfoFile =
_getResidentCompilerInfoFile;
+2 -16
View File
@@ -643,26 +643,12 @@ class Server {
_handleWebSocketRequest(request);
return;
}
// Don't redirect HTTP VM service requests, just requests for Observatory
// Don't redirect HTTP VM service requests, just requests for DevTools
// assets.
if (!_serveObservatory && path == ROOT_REDIRECT_PATH) {
if (path == ROOT_REDIRECT_PATH) {
await _redirectToDevTools(request);
return;
}
if (assets == null) {
request.response.headers.contentType = ContentType.text;
request.response.write('This VM was built without the Observatory UI.');
request.response.close();
return;
}
final asset = assets![path];
if (asset != null) {
// Serving up a static asset (e.g. .css, .html, .png).
request.response.headers.contentType = ContentType.parse(asset.mimeType);
request.response.add(asset.data);
request.response.close();
return;
}
// HTTP based service request.
final client = HttpRequestClient(request, _service);
final message = Message.fromUri(
-70
View File
@@ -1,70 +0,0 @@
// Copyright (c) 2015, 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.
part of dart._vmservice;
class Asset {
final String name;
final Uint8List data;
Asset(this.name, this.data);
String get mimeType {
final extensionStart = name.lastIndexOf('.');
final extension = name.substring(extensionStart + 1);
switch (extension) {
case 'html':
return 'text/html; charset=UTF-8';
case 'dart':
return 'application/dart; charset=UTF-8';
case 'js':
return 'application/javascript; charset=UTF-8';
case 'css':
return 'text/css; charset=UTF-8';
case 'gif':
return 'image/gif';
case 'png':
return 'image/png';
case 'jpg':
return 'image/jpeg';
case 'jpeg':
return 'image/jpeg';
case 'svg':
return 'image/svg+xml';
default:
return 'text/plain';
}
}
static Map<String, Asset>? request() {
Uint8List? tarBytes = _requestAssets();
if (tarBytes == null) {
return null;
}
final assetList = _decodeAssets(tarBytes);
final assets = <String, Asset>{};
for (int i = 0; i < assetList.length; i += 2) {
final a = Asset(assetList[i] as String, assetList[i + 1] as Uint8List);
assets[a.name] = a;
}
return assets;
}
String toString() => '$name ($mimeType)';
}
@pragma("vm:external-name", "VMService_DecodeAssets")
external List<dynamic> _decodeAssets(Uint8List data);
Map<String, Asset>? _assets;
Map<String, Asset>? get assets {
if (_assets == null) {
try {
_assets = Asset.request();
} catch (e) {
print('Could not load Observatory assets: $e');
}
}
return _assets;
}
-13
View File
@@ -11,7 +11,6 @@ import 'dart:io' show Directory, File, InternetAddress, Platform, Socket;
import 'dart:math';
import 'dart:typed_data';
part 'asset.dart';
part 'client.dart';
part 'devfs.dart';
part 'constants.dart';
@@ -171,9 +170,6 @@ typedef Future<Uri?> WebServerControlCallback(bool enable, bool? silenceOutput);
/// server.
typedef void WebServerAcceptNewWebSocketConnectionsCallback(bool enable);
/// Called when a client wants the service to serve Observatory.
typedef void ServeObservatoryCallback();
/// Called when we want to get the appropriate resident compiler info file for
/// the current program execution.
typedef File? getResidentCompilerInfoFileCallback();
@@ -193,7 +189,6 @@ class VMServiceEmbedderHooks {
static WebServerControlCallback? webServerControl;
static WebServerAcceptNewWebSocketConnectionsCallback?
acceptNewWebSocketConnections;
static ServeObservatoryCallback? serveObservatory;
static getResidentCompilerInfoFileCallback? getResidentCompilerInfoFile;
}
@@ -815,10 +810,6 @@ class VMService extends MessageRouter {
if (message.completed) {
return await message.response;
}
if (message.method == '_serveObservatory') {
VMServiceEmbedderHooks.serveObservatory?.call();
return encodeSuccess(message);
}
if (message.method == '_yieldControlToDDS') {
return await _yieldControlToDDS(message);
}
@@ -911,10 +902,6 @@ external bool _vmListenStream(String streamId, bool include_privates);
@pragma("vm:external-name", "VMService_CancelStream")
external void _vmCancelStream(String streamId);
/// Get the bytes to the tar archive.
@pragma("vm:external-name", "VMService_RequestAssets")
external Uint8List? _requestAssets();
@pragma("vm:external-name", "VMService_AddUserTagsToStreamableSampleList")
external void _addUserTagsToStreamableSampleList(List<String> userTags);
-12
View File
@@ -78,14 +78,11 @@ for command; do
-K 'kDartVmSnapshotInstructions' \
-K 'kDartCoreIsolateSnapshotData' \
-K 'kDartCoreIsolateSnapshotInstructions' \
-K '_ZN4dart3bin26observatory_assets_archiveE' \
-K '_ZN4dart3bin30observatory_assets_archive_lenE' \
-K '_ZN4dart3bin7Builtin22_builtin_source_paths_E' \
-K '_ZN4dart3bin7Builtin*_paths_E' \
-K '_ZN4dart3binL17vm_snapshot_data_E' \
-K '_ZN4dart3binL24isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL27core_isolate_snapshot_data_E' \
-K '_ZN4dart3binL27observatory_assets_archive_E' \
-K '_ZN4dart3binL27vm_isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL29core_isolate_snapshot_buffer_E' \
-K '_ZN4dart7Version14snapshot_hash_E' \
@@ -97,14 +94,11 @@ for command; do
-K 'kDartVmSnapshotInstructions' \
-K 'kDartCoreIsolateSnapshotData' \
-K 'kDartCoreIsolateSnapshotInstructions' \
-K '_ZN4dart3bin26observatory_assets_archiveE' \
-K '_ZN4dart3bin30observatory_assets_archive_lenE' \
-K '_ZN4dart3bin7Builtin22_builtin_source_paths_E' \
-K '_ZN4dart3bin7Builtin*_paths_E' \
-K '_ZN4dart3binL17vm_snapshot_data_E' \
-K '_ZN4dart3binL24isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL27core_isolate_snapshot_data_E' \
-K '_ZN4dart3binL27observatory_assets_archive_E' \
-K '_ZN4dart3binL27vm_isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL29core_isolate_snapshot_buffer_E' \
-K '_ZN4dart7Version14snapshot_hash_E' \
@@ -116,14 +110,11 @@ for command; do
-K 'kDartVmSnapshotInstructions' \
-K 'kDartCoreIsolateSnapshotData' \
-K 'kDartCoreIsolateSnapshotInstructions' \
-K '_ZN4dart3bin26observatory_assets_archiveE' \
-K '_ZN4dart3bin30observatory_assets_archive_lenE' \
-K '_ZN4dart3bin7Builtin22_builtin_source_paths_E' \
-K '_ZN4dart3bin7Builtin*_paths_E' \
-K '_ZN4dart3binL17vm_snapshot_data_E' \
-K '_ZN4dart3binL24isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL27core_isolate_snapshot_data_E' \
-K '_ZN4dart3binL27observatory_assets_archive_E' \
-K '_ZN4dart3binL27vm_isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL29core_isolate_snapshot_buffer_E' \
-K '_ZN4dart7Version14snapshot_hash_E' \
@@ -135,14 +126,11 @@ for command; do
-K 'kDartVmSnapshotInstructions' \
-K 'kDartCoreIsolateSnapshotData' \
-K 'kDartCoreIsolateSnapshotInstructions' \
-K '_ZN4dart3bin26observatory_assets_archiveE' \
-K '_ZN4dart3bin30observatory_assets_archive_lenE' \
-K '_ZN4dart3bin7Builtin22_builtin_source_paths_E' \
-K '_ZN4dart3bin7Builtin*_paths_E' \
-K '_ZN4dart3binL17vm_snapshot_data_E' \
-K '_ZN4dart3binL24isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL27core_isolate_snapshot_data_E' \
-K '_ZN4dart3binL27observatory_assets_archive_E' \
-K '_ZN4dart3binL27vm_isolate_snapshot_buffer_E' \
-K '_ZN4dart3binL29core_isolate_snapshot_buffer_E' \
-K '_ZN4dart7Version14snapshot_hash_E' \