f7a049dfb4
This change includes an initial implementation of the new VM service
implementation based on `package:dart_runtime_service`, along with the
necessary plumbing to start it in place of the legacy VM service
implementation.
The entrypoint for the new VM service implementation is located in
dart_runtime_service_vm/bin/vm_service_entrypoint.dart, which is
compiled into AppJIT and AOT snapshots when the
`--include-experimental-vm-service` flag is provided to `build.py`. To run
the VM with the new VM service implementation, the
`--experimental-vm-service` flag must be provided.
Currently, the experimental VM service implementation supports:
- User specified ports
- Authentication code flags
- Enabling the HTTP server via SIGQUIT
- Some service protocol RPCs that don't require an isolate ID (e.g.,
`getVM`)
See go/dart-runtime-services-unification for more details.
TEST=Manual
CoreLibraryReviewExempt: dart:_vmservice is private
Change-Id: I4a58cd1fa0a386313baa3d5c5345720231279123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/484820
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
98 lines
3.1 KiB
C++
98 lines
3.1 KiB
C++
// Copyright (c) 2013, 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.
|
|
|
|
#ifndef RUNTIME_BIN_VMSERVICE_IMPL_H_
|
|
#define RUNTIME_BIN_VMSERVICE_IMPL_H_
|
|
|
|
#include "include/dart_api.h"
|
|
|
|
#include "platform/globals.h"
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
class VmService {
|
|
public:
|
|
#if defined(PRODUCT)
|
|
static bool Setup(const char* server_ip,
|
|
intptr_t server_port,
|
|
bool dev_mode_server,
|
|
bool auth_codes_disabled,
|
|
const char* write_service_info_filename,
|
|
bool trace_loading,
|
|
bool deterministic,
|
|
bool enable_service_port_fallback,
|
|
bool wait_for_dds_to_advertise_service,
|
|
bool serve_devtools,
|
|
bool serve_observatory,
|
|
bool print_dtd,
|
|
bool should_use_resident_compiler,
|
|
const char* resident_compiler_info_file_path) {
|
|
return false;
|
|
}
|
|
|
|
static void SetNativeResolver() {}
|
|
|
|
// Error message if startup failed.
|
|
static const char* GetErrorMessage() {
|
|
return "VM Service not suppported in Product mode";
|
|
}
|
|
|
|
// HTTP Server's address.
|
|
static const char* GetServerAddress() { return nullptr; }
|
|
|
|
private:
|
|
#else // defined(PRODUCT)
|
|
static bool Setup(
|
|
const char* server_ip,
|
|
intptr_t server_port,
|
|
bool dev_mode_server,
|
|
bool auth_codes_disabled,
|
|
const char* write_service_info_filename,
|
|
bool trace_loading,
|
|
bool deterministic,
|
|
bool enable_service_port_fallback,
|
|
bool wait_for_dds_to_advertise_service,
|
|
bool serve_devtools,
|
|
bool serve_observatory,
|
|
bool print_dtd,
|
|
bool should_use_resident_compiler,
|
|
// If either --resident-compiler-info-file or --resident-server-info-file
|
|
// was supplied on the command line, the CLI argument should be forwarded
|
|
// as the argument to this parameter. If neither option was supplied, the
|
|
// argument to this parameter should be null.
|
|
const char* resident_compiler_info_file_path);
|
|
|
|
// Specifies that the experimental VM service implementation should be used.
|
|
// TODO(bkonyi): remove this variable when the experimental service is
|
|
// stable. This was only added as a public static to avoid temporarily
|
|
// modifying the signature of Setup(...).
|
|
static bool enable_experimental_vm_service;
|
|
|
|
static void SetNativeResolver();
|
|
|
|
// Error message if startup failed.
|
|
static const char* GetErrorMessage();
|
|
|
|
// HTTP Server's address.
|
|
static const char* GetServerAddress() { return &server_uri_[0]; }
|
|
|
|
private:
|
|
static constexpr intptr_t kServerUriStringBufferSize = 1024;
|
|
friend void NotifyServerState(Dart_NativeArguments args);
|
|
|
|
static void SetServerAddress(const char* server_uri_);
|
|
|
|
static const char* error_msg_;
|
|
static char server_uri_[kServerUriStringBufferSize];
|
|
#endif // defined(PRODUCT)
|
|
DISALLOW_ALLOCATION();
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(VmService);
|
|
};
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_BIN_VMSERVICE_IMPL_H_
|