Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 3918b329e217860eb0ba708bd36b7f0cc7bed572..8c9c55bb367af4febd15a586732cd5e25bfeb41b 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -153,6 +153,9 @@ class Isolate; |
*/ |
typedef void (*WeakReferenceCallback)(Persistent<Value> object, |
Sven Panne
2013/01/18 08:08:12
We should add a remark here that this kind of call
haraken
2013/01/22 00:27:37
Done.
|
void* parameter); |
+typedef void (*WeakenedReferenceCallback)(Isolate* isolate, |
Sven Panne
2013/01/18 08:08:12
Hmmm, I'm not totally happy with that name. We sho
haraken
2013/01/22 00:27:37
For now I changed the name to WeakHandleCallback.
|
+ Persistent<Value> object, |
+ void* parameter); |
// --- Handles --- |
@@ -411,6 +414,9 @@ template <class T> class Persistent : public Handle<T> { |
V8_INLINE(void MakeWeak(Isolate* isolate, |
void* parameters, |
WeakReferenceCallback callback)); |
+ V8_INLINE(void Weaken(Isolate* isolate, |
Sven Panne
2013/01/18 08:08:12
As discussed offline, the 3-arg MakeWeak is brand-
haraken
2013/01/22 00:27:37
Done.
|
+ void* parameters, |
+ WeakenedReferenceCallback callback)); |
/** Clears the weak reference to this object. */ |
V8_INLINE(void ClearWeak()); |
@@ -3527,6 +3533,10 @@ class V8EXPORT V8 { |
internal::Object** global_handle, |
void* data, |
WeakReferenceCallback); |
+ static void WeakenGlobal(internal::Isolate* isolate, |
Sven Panne
2013/01/18 08:08:12
see above
haraken
2013/01/22 00:27:37
Done.
|
+ internal::Object** global_handle, |
+ void* data, |
+ WeakenedReferenceCallback); |
static void ClearWeak(internal::Object** global_handle); |
static void MarkIndependent(internal::Object** global_handle); |
static void MarkIndependent(internal::Isolate* isolate, |
@@ -4371,6 +4381,15 @@ void Persistent<T>::MakeWeak(Isolate* isolate, void* parameters, |
} |
template <class T> |
+void Persistent<T>::Weaken(Isolate* isolate, void* parameters, |
Sven Panne
2013/01/18 08:08:12
see above
haraken
2013/01/22 00:27:37
Done.
|
+ WeakenedReferenceCallback callback) { |
+ V8::WeakenGlobal(reinterpret_cast<internal::Isolate*>(isolate), |
+ reinterpret_cast<internal::Object**>(**this), |
+ parameters, |
+ callback); |
+} |
+ |
+template <class T> |
void Persistent<T>::ClearWeak() { |
V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); |
} |