package.nan_persistent_12_inl.h Maven / Gradle / Ivy
Show all versions of nan Show documentation
/*********************************************************************
* NAN - Native Abstractions for Node.js
*
* Copyright (c) 2018 NAN contributors
*
* MIT License
********************************************************************/
#ifndef NAN_PERSISTENT_12_INL_H_
#define NAN_PERSISTENT_12_INL_H_
template class Persistent :
public v8::Persistent {
public:
inline Persistent() : v8::Persistent() {}
template inline Persistent(v8::Local that) :
v8::Persistent(v8::Isolate::GetCurrent(), that) {}
template
inline
Persistent(const v8::Persistent &that) : // NOLINT(runtime/explicit)
v8::Persistent(v8::Isolate::GetCurrent(), that) {}
inline void Reset() { v8::PersistentBase::Reset(); }
template
inline void Reset(const v8::Local &other) {
v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other);
}
template
inline void Reset(const v8::PersistentBase &other) {
v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other);
}
template
inline void SetWeak(
P *parameter
, typename WeakCallbackInfo::Callback callback
, WeakCallbackType type);
private:
inline T *operator*() const { return *PersistentBase::persistent; }
template
inline void Copy(const Persistent &that) {
TYPE_CHECK(T, S);
this->Reset();
if (!that.IsEmpty()) {
this->Reset(that);
M::Copy(that, this);
}
}
};
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
template
class Global : public v8::Global {
public:
inline Global() : v8::Global() {}
template inline Global(v8::Local that) :
v8::Global(v8::Isolate::GetCurrent(), that) {}
template
inline
Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit)
v8::Global(v8::Isolate::GetCurrent(), that) {}
inline void Reset() { v8::PersistentBase::Reset(); }
template
inline void Reset(const v8::Local &other) {
v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other);
}
template
inline void Reset(const v8::PersistentBase &other) {
v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other);
}
template
inline void SetWeak(
P *parameter
, typename WeakCallbackInfo::Callback callback
, WeakCallbackType type) {
reinterpret_cast*>(this)->SetWeak(
parameter, callback, type);
}
};
#else
template
class Global : public v8::UniquePersistent {
public:
inline Global() : v8::UniquePersistent() {}
template inline Global(v8::Local that) :
v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {}
template
inline
Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit)
v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {}
inline void Reset() { v8::PersistentBase::Reset(); }
template
inline void Reset(const v8::Local &other) {
v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other);
}
template
inline void Reset(const v8::PersistentBase &other) {
v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other);
}
template
inline void SetWeak(
P *parameter
, typename WeakCallbackInfo::Callback callback
, WeakCallbackType type) {
reinterpret_cast*>(this)->SetWeak(
parameter, callback, type);
}
};
#endif
#endif // NAN_PERSISTENT_12_INL_H_