Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Unified Diff: mojo/dart/dart_snapshotter/vm.h

Issue 1273743005: Dart: Adds a program to create snapshots of Mojo apps. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix asan build Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py ('k') | mojo/dart/dart_snapshotter/vm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py ('k') | mojo/dart/dart_snapshotter/vm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698