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

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

Issue 1762943002: Revert of Introduce v8::MicrotasksScope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « src/isolate.cc ('k') | test/cctest/test-microtask-delivery.cc » ('j') | 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 7eb6a5510b60c8fb0c0b2c4c51371bc31c0bf4d8..b0d80ed49a7d9a2da309aaa969e736a4ead97a83 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -20921,16 +20921,12 @@
static void MicrotaskOne(const v8::FunctionCallbackInfo<Value>& info) {
v8::HandleScope scope(info.GetIsolate());
- v8::MicrotasksScope microtasks(info.GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
CompileRun("ext1Calls++;");
}
static void MicrotaskTwo(const v8::FunctionCallbackInfo<Value>& info) {
v8::HandleScope scope(info.GetIsolate());
- v8::MicrotasksScope microtasks(info.GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
CompileRun("ext2Calls++;");
}
@@ -21065,7 +21061,7 @@
CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
CHECK_EQ(1u, microtasks_completed_callback_count);
- env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
+ env->GetIsolate()->SetAutorunMicrotasks(false);
env->GetIsolate()->EnqueueMicrotask(
Function::New(env.local(), MicrotaskOne).ToLocalChecked());
env->GetIsolate()->EnqueueMicrotask(
@@ -21092,7 +21088,7 @@
CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
CHECK_EQ(3u, microtasks_completed_callback_count);
- env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto);
+ env->GetIsolate()->SetAutorunMicrotasks(true);
env->GetIsolate()->EnqueueMicrotask(
Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
CompileRun("1+1;");
@@ -21129,7 +21125,7 @@
TEST(RunMicrotasksWithoutEnteringContext) {
v8::Isolate* isolate = CcTest::isolate();
HandleScope handle_scope(isolate);
- isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
+ isolate->SetAutorunMicrotasks(false);
Local<Context> context = Context::New(isolate);
{
Context::Scope context_scope(context);
@@ -21142,147 +21138,7 @@
Context::Scope context_scope(context);
CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(context).FromJust());
}
- isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto);
-}
-
-
-TEST(ScopedMicrotasks) {
- LocalContext env;
- v8::HandleScope handles(env->GetIsolate());
- env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped);
- {
- v8::MicrotasksScope scope1(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- env->GetIsolate()->EnqueueMicrotask(
- Function::New(env.local(), MicrotaskOne).ToLocalChecked());
- CompileRun(
- "var ext1Calls = 0;"
- "var ext2Calls = 0;");
- CompileRun("1+1;");
- CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- {
- v8::MicrotasksScope scope2(env->GetIsolate(),
- v8::MicrotasksScope::kRunMicrotasks);
- CompileRun("1+1;");
- CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- {
- v8::MicrotasksScope scope3(env->GetIsolate(),
- v8::MicrotasksScope::kRunMicrotasks);
- CompileRun("1+1;");
- CHECK_EQ(0,
- CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0,
- CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
- CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- env->GetIsolate()->EnqueueMicrotask(
- Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
- }
-
- {
- v8::MicrotasksScope scope(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- {
- v8::MicrotasksScope scope1(env->GetIsolate(),
- v8::MicrotasksScope::kRunMicrotasks);
- CompileRun("1+1;");
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- {
- v8::MicrotasksScope scope2(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- }
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- {
- v8::MicrotasksScope scope(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- env->GetIsolate()->EnqueueMicrotask(
- Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
- }
-
- {
- v8::Isolate::SuppressMicrotaskExecutionScope scope1(env->GetIsolate());
- {
- v8::MicrotasksScope scope2(env->GetIsolate(),
- v8::MicrotasksScope::kRunMicrotasks);
- }
- v8::MicrotasksScope scope3(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- {
- v8::MicrotasksScope scope1(env->GetIsolate(),
- v8::MicrotasksScope::kRunMicrotasks);
- v8::MicrotasksScope::PerformCheckpoint(env->GetIsolate());
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- {
- v8::MicrotasksScope scope(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- v8::MicrotasksScope::PerformCheckpoint(env->GetIsolate());
-
- {
- v8::MicrotasksScope scope(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- env->GetIsolate()->EnqueueMicrotask(
- Function::New(env.local(), MicrotaskTwo).ToLocalChecked());
- }
-
- v8::MicrotasksScope::PerformCheckpoint(env->GetIsolate());
-
- {
- v8::MicrotasksScope scope(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- env->GetIsolate()->EnqueueMicrotask(
- Function::New(env.local(), MicrotaskOne).ToLocalChecked());
- {
- v8::Isolate::SuppressMicrotaskExecutionScope scope1(env->GetIsolate());
- v8::MicrotasksScope::PerformCheckpoint(env->GetIsolate());
- v8::MicrotasksScope scope2(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- v8::MicrotasksScope::PerformCheckpoint(env->GetIsolate());
-
- {
- v8::MicrotasksScope scope(env->GetIsolate(),
- v8::MicrotasksScope::kDoNotRunMicrotasks);
- CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust());
- CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust());
- }
-
- env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto);
+ isolate->SetAutorunMicrotasks(true);
}
@@ -21305,7 +21161,7 @@
i::FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = CcTest::isolate();
HandleScope handle_scope(isolate);
- isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kExplicit);
+ isolate->SetAutorunMicrotasks(false);
Local<Context> context = Context::New(isolate);
v8::Debug::SetDebugEventListener(isolate, DebugEventInObserver);
{
@@ -21315,7 +21171,7 @@
"obj.a = 0;");
}
isolate->RunMicrotasks();
- isolate->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto);
+ isolate->SetAutorunMicrotasks(true);
v8::Debug::SetDebugEventListener(isolate, nullptr);
}
« no previous file with comments | « src/isolate.cc ('k') | test/cctest/test-microtask-delivery.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698