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

Unified Diff: src/api.cc

Issue 842153004: Unify phantom and internal fields weak handle callbacks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Require callback to reset handle. Created 5 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
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index fc528b679166b625cdba24f5fade1559e8ea93ce..51cd6c81fbca51c09645528293e35e9dc2eba43f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -408,18 +408,22 @@ void V8::MakeWeak(i::Object** object, void* parameter,
}
-void V8::MakePhantom(i::Object** object, void* parameter,
- PhantomCallbackData<void>::Callback weak_callback) {
- i::GlobalHandles::MakePhantom(object, parameter, weak_callback);
-}
-
-
void V8::MakePhantom(
- i::Object** object,
- InternalFieldsCallbackData<void, void>::Callback weak_callback,
- int internal_field_index1, int internal_field_index2) {
- i::GlobalHandles::MakePhantom(object, weak_callback, internal_field_index1,
- internal_field_index2);
+ i::Object** object, void* parameter, int internal_field_index1,
+ int internal_field_index2,
+ PhantomCallbackData<void, void, void>::Callback weak_callback) {
+ if (internal_field_index1 == 0) {
+ if (internal_field_index2 == 1) {
+ i::GlobalHandles::MakePhantom(object, parameter, 2, weak_callback);
+ } else {
+ DCHECK_EQ(internal_field_index2, Object::kNoInternalFieldIndex);
+ i::GlobalHandles::MakePhantom(object, parameter, 1, weak_callback);
+ }
+ } else {
+ DCHECK_EQ(internal_field_index1, Object::kNoInternalFieldIndex);
+ DCHECK_EQ(internal_field_index2, Object::kNoInternalFieldIndex);
+ i::GlobalHandles::MakePhantom(object, parameter, 0, weak_callback);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698