Index: mojo/dart/dart_snapshotter/vm.h |
diff --git a/mojo/dart/dart_snapshotter/vm.h b/mojo/dart/dart_snapshotter/vm.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..33ca79024c91a3f8524e1077b2337421eb8a2708 |
--- /dev/null |
+++ b/mojo/dart/dart_snapshotter/vm.h |
@@ -0,0 +1,46 @@ |
+// 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. |
+ |
+#ifndef MOJO_DART_DART_SNAPSHOTTER_VM_H_ |
+#define MOJO_DART_DART_SNAPSHOTTER_VM_H_ |
+ |
+#include "dart/runtime/include/dart_api.h" |
+#include "tonic/dart_library_provider.h" |
+#include "tonic/dart_state.h" |
+ |
+class SnapshotterDartState : public tonic::DartState { |
+ public: |
+ SnapshotterDartState() : library_provider_(nullptr) { |
+ }; |
+ |
+ tonic::DartLibraryProvider* library_provider() const { |
+ return library_provider_.get(); |
+ } |
+ |
+ void set_library_provider(tonic::DartLibraryProvider* library_provider) { |
+ library_provider_.reset(library_provider); |
+ DCHECK(library_provider_.get() == library_provider); |
+ } |
+ |
+ static SnapshotterDartState* From(Dart_Isolate isolate) { |
+ return reinterpret_cast<SnapshotterDartState*>(DartState::From(isolate)); |
+ } |
+ |
+ static SnapshotterDartState* Current() { |
+ return reinterpret_cast<SnapshotterDartState*>(DartState::Current()); |
+ } |
+ |
+ static SnapshotterDartState* Cast(void* data) { |
+ return reinterpret_cast<SnapshotterDartState*>(data); |
+ } |
+ |
+ private: |
+ std::unique_ptr<tonic::DartLibraryProvider> library_provider_; |
+}; |
+ |
+void InitDartVM(); |
+Dart_Isolate CreateDartIsolate(); |
+void LoadScript(const std::string& url); |
+ |
+#endif // MOJO_DART_DART_SNAPSHOTTER_VM_H_ |