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

Unified Diff: src/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/api.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 72de33dd47ced2cf7da6c62caf615f817c7a075c..bf57a3aa14376ab17e6c42a8004561e72a2f80e6 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -157,18 +157,6 @@
};
-#ifdef V8_ENABLE_CHECKS
-void CheckMicrotasksScopesConsistency(i::Isolate* isolate) {
- auto handle_scope_implementer = isolate->handle_scope_implementer();
- if (handle_scope_implementer->microtasks_policy() ==
- v8::MicrotasksPolicy::kScoped) {
- DCHECK(handle_scope_implementer->GetMicrotasksScopeDepth() ||
- !handle_scope_implementer->DebugMicrotasksScopeDepthIsZero());
- }
-}
-#endif
-
-
class CallDepthScope {
public:
explicit CallDepthScope(i::Isolate* isolate, Local<Context> context,
@@ -188,9 +176,6 @@
if (!context_.IsEmpty()) context_->Exit();
if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
if (do_callback_) isolate_->FireCallCompletedCallback();
-#ifdef V8_ENABLE_CHECKS
- if (do_callback_) CheckMicrotasksScopesConsistency(isolate_);
-#endif
}
void Escape() {
@@ -7313,12 +7298,10 @@
Isolate* isolate)
: isolate_(reinterpret_cast<i::Isolate*>(isolate)) {
isolate_->handle_scope_implementer()->IncrementCallDepth();
- isolate_->handle_scope_implementer()->IncrementMicrotasksSuppressions();
}
Isolate::SuppressMicrotaskExecutionScope::~SuppressMicrotaskExecutionScope() {
- isolate_->handle_scope_implementer()->DecrementMicrotasksSuppressions();
isolate_->handle_scope_implementer()->DecrementCallDepth();
}
@@ -7460,7 +7443,6 @@
void Isolate::RunMicrotasks() {
- DCHECK(MicrotasksPolicy::kScoped != GetMicrotasksPolicy());
reinterpret_cast<i::Isolate*>(this)->RunMicrotasks();
}
@@ -7484,25 +7466,12 @@
void Isolate::SetAutorunMicrotasks(bool autorun) {
- SetMicrotasksPolicy(MicrotasksPolicy::kAuto);
+ reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun);
}
bool Isolate::WillAutorunMicrotasks() const {
- return GetMicrotasksPolicy() == MicrotasksPolicy::kAuto;
-}
-
-
-void Isolate::SetMicrotasksPolicy(MicrotasksPolicy policy) {
- i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
- isolate->handle_scope_implementer()->set_microtasks_policy(policy);
-}
-
-
-MicrotasksPolicy Isolate::GetMicrotasksPolicy() const {
- i::Isolate* isolate =
- reinterpret_cast<i::Isolate*>(const_cast<Isolate*>(this));
- return isolate->handle_scope_implementer()->microtasks_policy();
+ return reinterpret_cast<const i::Isolate*>(this)->autorun_microtasks();
}
@@ -7738,49 +7707,6 @@
VisitorAdapter visitor_adapter(visitor);
isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds(
&visitor_adapter);
-}
-
-
-MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type)
- : isolate_(reinterpret_cast<i::Isolate*>(isolate)),
- run_(type == MicrotasksScope::kRunMicrotasks) {
- auto handle_scope_implementer = isolate_->handle_scope_implementer();
- if (run_) handle_scope_implementer->IncrementMicrotasksScopeDepth();
-#ifdef V8_ENABLE_CHECKS
- if (!run_) handle_scope_implementer->IncrementDebugMicrotasksScopeDepth();
-#endif
-}
-
-
-MicrotasksScope::~MicrotasksScope() {
- auto handle_scope_implementer = isolate_->handle_scope_implementer();
- if (run_) {
- handle_scope_implementer->DecrementMicrotasksScopeDepth();
- if (MicrotasksPolicy::kScoped ==
- handle_scope_implementer->microtasks_policy()) {
- PerformCheckpoint(reinterpret_cast<Isolate*>(isolate_));
- }
- }
-#ifdef V8_ENABLE_CHECKS
- if (!run_) handle_scope_implementer->DecrementDebugMicrotasksScopeDepth();
-#endif
-}
-
-
-void MicrotasksScope::PerformCheckpoint(Isolate* v8Isolate) {
- i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8Isolate);
- if (IsExecutionTerminatingCheck(isolate)) return;
- auto handle_scope_implementer = isolate->handle_scope_implementer();
- if (!handle_scope_implementer->GetMicrotasksScopeDepth() &&
- !handle_scope_implementer->HasMicrotasksSuppressions()) {
- isolate->RunMicrotasks();
- }
-}
-
-
-int MicrotasksScope::GetCurrentDepth(Isolate* v8Isolate) {
- i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8Isolate);
- return isolate->handle_scope_implementer()->GetMicrotasksScopeDepth();
}
« no previous file with comments | « src/api.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698