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

Unified Diff: test/cctest/test-api.cc

Issue 1209403005: Let the second pass phantom callbacks run in a separate task on the foreground thread. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/list-inl.h ('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 1433b7bed6b86a6a1a664818e34bb47c786618de..234e8cee598197473e6f7abbbea73675a0b77111 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -36,6 +36,7 @@
#include <unistd.h> // NOLINT
#endif
+#include "include/libplatform/libplatform.h"
#include "include/v8-util.h"
#include "src/api.h"
#include "src/arguments.h"
@@ -88,6 +89,11 @@ using ::v8::Value;
} \
THREADED_TEST(Name)
+#define ENSURE_TASKS_HAVE_BEEN_RUN(isolate) \
+ while (v8::platform::PumpMessageLoop(v8::internal::V8::GetCurrentPlatform(), \
+ (isolate))) \
+ ;
+
void RunWithProfiler(void (*test)()) {
LocalContext env;
@@ -3275,6 +3281,7 @@ TEST(TwoPassPhantomCallbacks) {
}
CHECK_EQ(static_cast<int>(kLength), instance_counter);
CcTest::heap()->CollectAllGarbage();
+ ENSURE_TASKS_HAVE_BEEN_RUN(isolate);
CHECK_EQ(0, instance_counter);
}
@@ -3293,6 +3300,7 @@ TEST(TwoPassPhantomCallbacksNestedGc) {
array[15]->MarkTriggerGc();
CHECK_EQ(static_cast<int>(kLength), instance_counter);
CcTest::heap()->CollectAllGarbage();
+ ENSURE_TASKS_HAVE_BEEN_RUN(isolate);
CHECK_EQ(0, instance_counter);
}
@@ -6806,6 +6814,7 @@ THREADED_TEST(GCFromWeakCallbacks) {
v8::WeakCallbackType::kParameter);
object.handle.MarkIndependent();
invoke_gc[outer_gc]();
+ ENSURE_TASKS_HAVE_BEEN_RUN(isolate);
CHECK(object.flag);
}
}
« src/global-handles.cc ('K') | « src/list-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698