Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mojo/dart/dart_snapshotter/vm.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "mojo/dart/dart_snapshotter/loader.h" | |
| 9 #include "tonic/dart_error.h" | |
| 10 #include "tonic/dart_state.h" | |
| 11 | |
| 12 namespace mojo { | |
| 13 namespace dart { | |
| 14 extern const uint8_t* vm_isolate_snapshot_buffer; | |
| 15 extern const uint8_t* isolate_snapshot_buffer; | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 static const char* kDartArgs[] = { | |
| 20 "--enable_mirrors=false", | |
| 21 }; | |
| 22 | |
| 23 void InitDartVM() { | |
| 24 CHECK(Dart_SetVMFlags(arraysize(kDartArgs), kDartArgs)); | |
| 25 CHECK(Dart_Initialize(mojo::dart::vm_isolate_snapshot_buffer, nullptr, | |
| 26 nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, | |
| 27 nullptr, nullptr)); | |
| 28 } | |
| 29 | |
| 30 Dart_Isolate CreateDartIsolate() { | |
| 31 CHECK(mojo::dart::isolate_snapshot_buffer); | |
| 32 char* error = nullptr; | |
| 33 Dart_Isolate isolate = Dart_CreateIsolate("dart:snapshot", "main", | |
|
Cutch
2015/08/11 14:18:06
Does this "dart:" url make it into the program tha
zra
2015/08/11 17:03:21
This string is only used for debug messages, and d
| |
| 34 mojo::dart::isolate_snapshot_buffer, | |
| 35 nullptr, nullptr, &error); | |
| 36 | |
| 37 CHECK(isolate) << error; | |
| 38 CHECK(!tonic::LogIfError(Dart_SetLibraryTagHandler(HandleLibraryTag))); | |
| 39 | |
| 40 Dart_ExitIsolate(); | |
| 41 return isolate; | |
| 42 } | |
| OLD | NEW |