Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: include/v8.h

Issue 11959031: Add a new weak handle callback that passes an Isolate to an embedder (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698