Index: runtime/vm/dart_api_impl.h |
diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h |
index 2f10f43388dff386593b35a404bc81d2ee234e2b..3a5cf64db628b42fb5b7d3f75fc6275a92deacc8 100644 |
--- a/runtime/vm/dart_api_impl.h |
+++ b/runtime/vm/dart_api_impl.h |
@@ -109,6 +109,20 @@ const char* CanonicalFunction(const char* func); |
class Api : AllStatic { |
public: |
+ // Create on the stack to provide a new throw-safe api scope. |
+ class Scope : public StackResource { |
+ public: |
+ explicit Scope(Isolate* isolate) : StackResource(isolate) { |
+ Dart_EnterScope(); |
+ } |
+ ~Scope() { |
+ Dart_ExitScope(); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(Scope); |
+ }; |
+ |
// Creates a new local handle. |
static Dart_Handle NewHandle(Isolate* isolate, RawObject* raw); |