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

Unified Diff: test/cctest/test-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
« src/global-handles.cc ('K') | « src/global-handles.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index d18059cd54bdadb05e6309e198682391d63496f0..e62b0ede9b898071c720bebd45f5792f48f0d3a1 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -7796,8 +7796,10 @@ class Trivial2 {
};
-void CheckInternalFields(
- const v8::InternalFieldsCallbackData<Trivial, Trivial2>& data) {
+void CheckInternalFields(const v8::PhantomCallbackData<
+ v8::Persistent<v8::Object>, Trivial, Trivial2>& data) {
+ v8::Persistent<v8::Object>* handle = data.GetParameter();
+ handle->Reset();
Trivial* t1 = data.GetInternalField1();
Trivial2* t2 = data.GetInternalField2();
CHECK_EQ(42, t1->x());
@@ -7835,7 +7837,8 @@ void InternalFieldCallback(bool global_gc) {
reinterpret_cast<Trivial2*>(obj->GetAlignedPointerFromInternalField(1));
CHECK_EQ(103, t2->x());
- handle.SetPhantom(CheckInternalFields, 0, 1);
+ handle.SetPhantom<v8::Persistent<v8::Object>, Trivial, Trivial2>(
+ &handle, 0, 1, CheckInternalFields);
if (!global_gc) {
handle.MarkIndependent();
}
« src/global-handles.cc ('K') | « src/global-handles.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698