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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h

Issue 1743763004: Use v8::MicrotasksScope internally in V8RecursionScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8rs-2-endofscope
Patch Set: v8_helpers Created 4 years, 9 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: third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h
index dd9a51fb354f2ce33937587882c6ff849a61cb30..8bbd26cd3dfbc9b2144110a0f174bbe484cd7a28 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8RecursionScope.h
@@ -59,63 +59,39 @@ class CORE_EXPORT V8RecursionScope {
STACK_ALLOCATED();
public:
explicit V8RecursionScope(v8::Isolate* isolate)
- : m_isolate(isolate)
+ : m_scope(isolate, v8::MicrotasksScope::kRunMicrotasks)
{
- V8PerIsolateData::from(m_isolate)->incrementRecursionLevel();
- // If you want V8 to autorun microtasks, this class needs to have a
- // v8::Isolate::SuppressMicrotaskExecutionScope member.
- ASSERT(!isolate->WillAutorunMicrotasks());
+ ASSERT(isolate->GetMicrotasksPolicy() == v8::MicrotasksPolicy::kScoped);
}
~V8RecursionScope()
{
- if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel())
- didLeaveScriptContext();
}
static int recursionLevel(v8::Isolate* isolate)
{
- return V8PerIsolateData::from(isolate)->recursionLevel();
+ return v8::MicrotasksScope::GetCurrentDepth(isolate);
}
-#if ENABLE(ASSERT)
- static bool properlyUsed(v8::Isolate* isolate)
- {
- return recursionLevel(isolate) > 0 || V8PerIsolateData::from(isolate)->internalScriptRecursionLevel() > 0;
- }
-#endif
-
class MicrotaskSuppression {
USING_FAST_MALLOC(MicrotaskSuppression);
WTF_MAKE_NONCOPYABLE(MicrotaskSuppression);
public:
- MicrotaskSuppression(v8::Isolate* isolate)
-#if ENABLE(ASSERT)
- : m_isolate(isolate)
-#endif
+ explicit MicrotaskSuppression(v8::Isolate* isolate)
+ : m_scope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks)
{
-#if ENABLE(ASSERT)
- V8PerIsolateData::from(m_isolate)->incrementInternalScriptRecursionLevel();
-#endif
}
~MicrotaskSuppression()
{
-#if ENABLE(ASSERT)
- V8PerIsolateData::from(m_isolate)->decrementInternalScriptRecursionLevel();
-#endif
}
private:
-#if ENABLE(ASSERT)
- v8::Isolate* m_isolate;
-#endif
+ v8::MicrotasksScope m_scope;
};
private:
- void didLeaveScriptContext();
-
- v8::Isolate* m_isolate;
+ v8::MicrotasksScope m_scope;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698