MCPcopy Create free account
hub / github.com/nodejs/nan / EscapableHandleScope

Class EscapableHandleScope

nan.h:473–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471};
472
473class EscapableHandleScope {
474 public:
475#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
476 inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {}
477
478 inline static int NumberOfHandles() {
479 return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent());
480 }
481
482 template<typename T>
483 inline v8::Local<T> Escape(v8::Local<T> value) {
484 return scope.Escape(value);
485 }
486
487 private:
488 v8::EscapableHandleScope scope;
489#else
490 inline EscapableHandleScope() : scope() {}
491
492 inline static int NumberOfHandles() {
493 return v8::HandleScope::NumberOfHandles();
494 }
495
496 template<typename T>
497 inline v8::Local<T> Escape(v8::Local<T> value) {
498 return scope.Close(value);
499 }
500
501 private:
502 v8::HandleScope scope;
503#endif
504
505 private:
506 // Make it hard to create heap-allocated or illegal handle scopes by
507 // disallowing certain operations.
508 EscapableHandleScope(const EscapableHandleScope &);
509 void operator=(const EscapableHandleScope &);
510 void *operator new(size_t size);
511 void operator delete(void *, size_t) {
512 abort();
513 }
514};
515
516//=== TryCatch =================================================================
517

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected