Make --trace-loading great again.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2775463002 .
This commit is contained in:
Ryan Macnak 2017-03-22 17:06:42 -07:00
parent ff1a3f4f2d
commit 2aecd5e588
5 changed files with 16 additions and 6 deletions

View file

@ -1428,7 +1428,8 @@ static Dart_Isolate CreateServiceIsolate(const char* script_uri,
ASSERT(Dart_IsServiceIsolate(isolate));
// Load embedder specific bits and return. Will not start http server.
if (!VmService::Setup("127.0.0.1", -1, false /* running_precompiled */,
false /* server dev mode */)) {
false /* server dev mode */,
false /* trace_loading */)) {
*error = strdup(VmService::GetErrorMessage());
return NULL;
}

View file

@ -917,7 +917,8 @@ static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate,
// If this is the service isolate, load embedder specific bits and return.
bool skip_library_load = isolate_run_app_snapshot;
if (!VmService::Setup(vm_service_server_ip, vm_service_server_port,
skip_library_load, vm_service_dev_mode)) {
skip_library_load, vm_service_dev_mode,
trace_loading)) {
*error = strdup(VmService::GetErrorMessage());
return NULL;
}

View file

@ -62,6 +62,8 @@ class FileRequest {
FileRequest(this.sp, this.tag, this.uri, this.resolvedUri, this.libraryUrl);
}
bool _traceLoading = false;
// State associated with the isolate that is used for loading.
class IsolateLoaderState extends IsolateEmbedderData {
IsolateLoaderState(this.isolateId);
@ -101,8 +103,6 @@ class IsolateLoaderState extends IsolateEmbedderData {
// The root script's uri.
Uri _rootScript;
bool _traceLoading = false;
// Packages are either resolved looking up in a map or resolved from within a
// package root.
bool get _packagesReady =>

View file

@ -170,7 +170,8 @@ bool VmService::LoadForGenPrecompiled() {
bool VmService::Setup(const char* server_ip,
intptr_t server_port,
bool running_precompiled,
bool dev_mode_server) {
bool dev_mode_server,
bool trace_loading) {
Dart_Isolate isolate = Dart_CurrentIsolate();
ASSERT(isolate != NULL);
SetServerAddress("");
@ -257,6 +258,12 @@ bool VmService::Setup(const char* server_ip,
Dart_SetField(library, DartUtils::NewString("_isFuchsia"), is_fuchsia);
SHUTDOWN_ON_ERROR(result);
if (trace_loading) {
result = Dart_SetField(library, DartUtils::NewString("_traceLoading"),
Dart_True());
SHUTDOWN_ON_ERROR(result);
}
// Get _getWatchSignalInternal from dart:io.
Dart_Handle dart_io_str = Dart_NewStringFromCString(DartUtils::kIOLibURL);
SHUTDOWN_ON_ERROR(dart_io_str);

View file

@ -19,7 +19,8 @@ class VmService {
static bool Setup(const char* server_ip,
intptr_t server_port,
bool running_precompiled,
bool dev_mode_server);
bool dev_mode_server,
bool trace_loading);
// Error message if startup failed.
static const char* GetErrorMessage();