Showing with 12 additions and 0 deletions.
  1. +2 −0 include/candor.h
  2. +10 −0 src/api.cc
@@ -281,6 +281,8 @@ class CWrapper {

void Ref();
void Unref();
bool IsWeak();
bool IsPersistent();

protected:
static void WeakCallback(Value* data);
@@ -555,6 +555,16 @@ void CWrapper::Unref() {
}


bool CWrapper::IsWeak() {
return ref.IsWeak();
}


bool CWrapper::IsPersistent() {
return ref.IsPersistent();
}


void CWrapper::WeakCallback(Value* data) {
CWrapper* wrapper = *reinterpret_cast<CWrapper**>(
data->As<CData>()->GetContents());