Index: mojo/dart/dart_snapshotter/scope.h |
diff --git a/mojo/dart/dart_snapshotter/scope.h b/mojo/dart/dart_snapshotter/scope.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5ee3193a7fa7a33ca7628c6903e7f6b490dc5639 |
--- /dev/null |
+++ b/mojo/dart/dart_snapshotter/scope.h |
@@ -0,0 +1,33 @@ |
+// 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_SCOPE_H_ |
+#define MOJO_DART_DART_SNAPSHOTTER_SCOPE_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/logging.h" |
+#include "dart/runtime/include/dart_api.h" |
+ |
+class DartIsolateScope { |
+ public: |
+ explicit DartIsolateScope(Dart_Isolate isolate) { |
+ CHECK(!Dart_CurrentIsolate()); |
+ Dart_EnterIsolate(isolate); |
+ } |
+ ~DartIsolateScope() { Dart_ExitIsolate(); } |
Cutch
2015/08/10 20:45:02
Use //tonic/dart_api_scope.h and //tonic/dart_isol
zra
2015/08/10 22:59:22
Done.
|
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DartIsolateScope); |
+}; |
+ |
+class DartApiScope { |
+ public: |
+ DartApiScope() { Dart_EnterScope(); } |
+ ~DartApiScope() { Dart_ExitScope(); } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DartApiScope); |
+}; |
+ |
+#endif // MOJO_DART_DART_SNAPSHOTTER_SCOPE_H_ |