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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp

Issue 1777183002: Revert of Use v8::MicrotasksScope internally in V8RecursionScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8rs-2-endofscope
Patch Set: Resolve patch conflict 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/V8PerIsolateData.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
index 65c02bcd042673e5564ec6d50a3bba4e56cd1a79..0a2cfcb91e350d51b0e373a3f71707588fbdf081 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
@@ -30,6 +30,7 @@
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8HiddenValue.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
+#include "bindings/core/v8/V8RecursionScope.h"
#include "bindings/core/v8/V8ScriptRunner.h"
#include "core/frame/Deprecation.h"
#include "core/inspector/MainThreadDebugger.h"
@@ -52,6 +53,18 @@ static void microtasksCompletedCallback(v8::Isolate* isolate)
V8PerIsolateData::from(isolate)->runEndOfScopeTasks();
}
+#if ENABLE(ASSERT)
+static void assertV8RecursionScope(v8::Isolate* isolate)
+{
+ ASSERT(V8RecursionScope::properlyUsed(isolate));
+}
+
+static bool runningUnitTest()
+{
+ return Platform::current()->unitTestSupport();
+}
+#endif
+
static void useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeature feature)
{
UseCounter::Feature blinkFeature;
@@ -130,15 +143,25 @@ static void useCounterCallback(v8::Isolate* isolate, v8::Isolate::UseCounterFeat
}
V8PerIsolateData::V8PerIsolateData()
- : m_isolateHolder(adoptPtr(new gin::IsolateHolder()))
+ : m_destructionPending(false)
+ , m_isolateHolder(adoptPtr(new gin::IsolateHolder()))
, m_stringCache(adoptPtr(new StringCache(isolate())))
, m_hiddenValue(V8HiddenValue::create())
, m_constructorMode(ConstructorMode::CreateNewObject)
+ , m_recursionLevel(0)
, m_isHandlingRecursionLevelError(false)
, m_isReportingException(false)
+#if ENABLE(ASSERT)
+ , m_internalScriptRecursionLevel(0)
+#endif
+ , m_performingMicrotaskCheckpoint(false)
{
// FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone.
isolate()->Enter();
+#if ENABLE(ASSERT)
+ if (!runningUnitTest())
+ isolate()->AddCallCompletedCallback(&assertV8RecursionScope);
+#endif
isolate()->AddBeforeCallEnteredCallback(&beforeCallEnteredCallback);
isolate()->AddMicrotasksCompletedCallback(&microtasksCompletedCallback);
if (isMainThread())
@@ -183,6 +206,9 @@ void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate)
{
V8PerIsolateData* data = from(isolate);
+ ASSERT(!data->m_destructionPending);
+ data->m_destructionPending = true;
+
data->m_threadDebugger.clear();
// Clear any data that may have handles into the heap,
// prior to calling ThreadState::detach().
@@ -193,6 +219,10 @@ void V8PerIsolateData::willBeDestroyed(v8::Isolate* isolate)
// gets called but before the Isolate exits.
void V8PerIsolateData::destroy(v8::Isolate* isolate)
{
+#if ENABLE(ASSERT)
+ if (!runningUnitTest())
+ isolate->RemoveCallCompletedCallback(&assertV8RecursionScope);
+#endif
isolate->RemoveBeforeCallEnteredCallback(&beforeCallEnteredCallback);
isolate->RemoveMicrotasksCompletedCallback(&microtasksCompletedCallback);
V8PerIsolateData* data = from(isolate);

Powered by Google App Engine
This is Rietveld 408576698