diff --git a/README.md b/README.md index a9343f1b..441243b6 100644 --- a/README.md +++ b/README.md @@ -301,6 +301,12 @@ NAN_METHOD(CalculateAsync) { * NanRemoveGCEpilogueCallback * NanRemoveGCPrologueCallback * NanGetHeapStatistics + * NanSetCounterFunction + * NanSetCreateHistogramFunction + * NanSetAddHistogramSampleFunction + * NanIdleNotification + * NanLowMemoryNotification + * NanContextDisposedNotification * NanCallback * NanAsyncWorker * NanAsyncQueueWorker @@ -1097,6 +1103,36 @@ Simply does `RemoveGCPrologueCallback` Simply does `GetHeapStatistics` + +### NanSetCounterFunction(CounterLookupCallback cb) + +Simply does `SetCounterFunction` + + +### NanSetCreateHistogramFunction(CreateHistogramCallback cb) + +Simply does `SetCreateHistogramFunction` + + +### NanSetAddHistogramSampleFunction(AddHistogramSampleCallback cb) + +Simply does `SetAddHistogramSampleFunction` + + +### NanIdleNotification(int idle_time_in_ms) + +Simply does `IdleNotification` + + +### NanLowMemoryNotification() + +Simply does `LowMemoryNotification` + + +### NanContextDisposedNotification() + +Simply does `ContextDisposedNotification` + ### NanCallback diff --git a/nan.h b/nan.h index ea4addf5..a0aa951b 100644 --- a/nan.h +++ b/nan.h @@ -155,6 +155,62 @@ NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { return val; } +#if NODE_MODULE_VERSION >= 42 // io.js 1.0 + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::Isolate::GetCurrent()->SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::Isolate::GetCurrent()->LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::Isolate::GetCurrent()->ContextDisposedNotification(); + } +#else + NAN_INLINE + void NanSetCounterFunction(v8::CounterLookupCallback cb) { + v8::V8::SetCounterFunction(cb); + } + + NAN_INLINE + void NanSetCreateHistogramFunction(v8::CreateHistogramCallback cb) { + v8::V8::SetCreateHistogramFunction(cb); + } + + NAN_INLINE + void NanSetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { + v8::V8::SetAddHistogramSampleFunction(cb); + } + + NAN_INLINE bool NanIdleNotification(int idle_time_in_ms) { + return v8::V8::IdleNotification(idle_time_in_ms); + } + + NAN_INLINE void NanLowMemoryNotification() { + v8::V8::LowMemoryNotification(); + } + + NAN_INLINE void NanContextDisposedNotification() { + v8::V8::ContextDisposedNotification(); + } +#endif + #if (NODE_MODULE_VERSION > 0x000B) // Node 0.11+ (0.11.12 and below won't compile with these)