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 "sky/tools/packager/vm.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "sky/tools/packager/loader.h" |
| 9 #include "sky/tools/packager/logging.h" |
| 10 |
| 11 namespace blink { |
| 12 extern const uint8_t* kDartVmIsolateSnapshotBuffer; |
| 13 extern const uint8_t* kDartIsolateSnapshotBuffer; |
| 14 } |
| 15 |
| 16 void InitDartVM() { |
| 17 int argc = 0; |
| 18 const char** argv = nullptr; |
| 19 |
| 20 CHECK(Dart_SetVMFlags(argc, argv)); |
| 21 CHECK(Dart_Initialize(blink::kDartVmIsolateSnapshotBuffer, |
| 22 nullptr, // Isolate created callback. |
| 23 nullptr, // Isolate interrupt callback. |
| 24 nullptr, // Unhandled exception callback. |
| 25 nullptr, // Isolate shutdown callback. |
| 26 // File IO callbacks. |
| 27 nullptr, nullptr, nullptr, nullptr, nullptr)); |
| 28 } |
| 29 |
| 30 Dart_Isolate CreateDartIsolate() { |
| 31 CHECK(blink::kDartIsolateSnapshotBuffer); |
| 32 char* error = nullptr; |
| 33 Dart_Isolate isolate = |
| 34 Dart_CreateIsolate("http://example.com", "main", |
| 35 blink::kDartIsolateSnapshotBuffer, nullptr, &error); |
| 36 |
| 37 CHECK(isolate) << error; |
| 38 CHECK(!LogIfError(Dart_SetLibraryTagHandler(HandleLibraryTag))); |
| 39 LoadSkyInternals(); |
| 40 |
| 41 Dart_ExitIsolate(); |
| 42 return isolate; |
| 43 } |
OLD | NEW |