Chromium Code Reviews| Index: runtime/vm/handles.h |
| =================================================================== |
| --- runtime/vm/handles.h (revision 24061) |
| +++ runtime/vm/handles.h (working copy) |
| @@ -228,6 +228,7 @@ |
| friend class HandleScope; |
| friend class Dart; |
| friend class ObjectStore; |
| + friend class Isolate; |
| DISALLOW_ALLOCATION(); |
| DISALLOW_COPY_AND_ASSIGN(Handles); |
| }; |
| @@ -338,9 +339,48 @@ |
| #endif // defined(DEBUG) |
| // Macro to start a no handles scope in the code. |
| -#define NOHANDLESCOPE(isolate) \ |
| +#define NOHANDLESCOPE(isolate) \ |
| dart::NoHandleScope no_vm_internal_handles_scope_(isolate); |
| + |
| +// The class ReusableHandleScope is used in regions of the |
| +// virtual machine where isolate specific reusable handles are used. |
| +// This class asserts that we do not add code that will result in recursive |
| +// uses of reusable handles. |
| +// It is used as follows: |
| +// { |
| +// REUSABLE_HANDLESCOPE(isolate); |
| +// .... |
| +// ..... |
| +// code that uses isolate specific reusable handles. |
| +// .... |
| +// } |
| +#if defined(DEBUG) |
| +class ReusableHandleScope : public StackResource { |
| + public: |
| + explicit ReusableHandleScope(BaseIsolate* isolate); |
| + ReusableHandleScope(); |
| + ~ReusableHandleScope(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ReusableHandleScope); |
| +}; |
| +#else // defined(DEBUG) |
| +class ReusableHandleScope : public ValueObject { |
| + public: |
| + explicit ReusableHandleScope(BaseIsolate* isolate) { } |
| + ReusableHandleScope() { } |
| + ~ReusableHandleScope() { } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ReusableHandleScope); |
| +}; |
| +#endif // defined(DEBUG) |
| + |
| +// Macro to start a no handles scope in the code. |
|
Ivan Posva
2013/06/16 11:15:26
Comment does not match code.
siva
2013/06/19 20:41:55
Done.
|
| +#define REUSABLE_HANDLESCOPE(isolate) \ |
| + dart::ReusableHandleScope reusable_vm_internal_handles_scope_(isolate); |
| + |
| } // namespace dart |
| #endif // VM_HANDLES_H_ |