mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
We don't use dart:mirrors and we don't want to start because it prevents some sorts of static analysis. R=ianh@google.com Review URL: https://codereview.chromium.org/1233463002 .
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
// 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.
|
|
|
|
#include "sky/tools/packager/vm.h"
|
|
|
|
#include "base/logging.h"
|
|
#include "sky/tools/packager/loader.h"
|
|
#include "sky/tools/packager/logging.h"
|
|
|
|
namespace blink {
|
|
extern const uint8_t* kDartVmIsolateSnapshotBuffer;
|
|
extern const uint8_t* kDartIsolateSnapshotBuffer;
|
|
}
|
|
|
|
static const char* kDartArgs[] = {
|
|
"--enable_mirrors=false",
|
|
};
|
|
|
|
void InitDartVM() {
|
|
CHECK(Dart_SetVMFlags(arraysize(kDartArgs), kDartArgs));
|
|
CHECK(Dart_Initialize(blink::kDartVmIsolateSnapshotBuffer, nullptr, nullptr,
|
|
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
|
nullptr));
|
|
}
|
|
|
|
Dart_Isolate CreateDartIsolate() {
|
|
CHECK(blink::kDartIsolateSnapshotBuffer);
|
|
char* error = nullptr;
|
|
Dart_Isolate isolate = Dart_CreateIsolate("dart:snapshot", "main",
|
|
blink::kDartIsolateSnapshotBuffer,
|
|
nullptr, nullptr, &error);
|
|
|
|
CHECK(isolate) << error;
|
|
CHECK(!LogIfError(Dart_SetLibraryTagHandler(HandleLibraryTag)));
|
|
|
|
Dart_ExitIsolate();
|
|
return isolate;
|
|
}
|