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

Unified Diff: Source/bindings/v8/V8RecursionScope.h

Issue 466243002: Support merged Dart-JS callstacks (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 6 years, 4 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: Source/bindings/v8/V8RecursionScope.h
diff --git a/Source/bindings/v8/V8RecursionScope.h b/Source/bindings/v8/V8RecursionScope.h
index 0a150c3b9fe6a96058f3519a0f6bcd5e2ea726aa..962375bec61189dabe8a993efc358400ec474f8c 100644
--- a/Source/bindings/v8/V8RecursionScope.h
+++ b/Source/bindings/v8/V8RecursionScope.h
@@ -31,6 +31,7 @@
#ifndef V8RecursionScope_h
#define V8RecursionScope_h
+#include "bindings/common/StackTrace.h"
#include "bindings/v8/V8PerIsolateData.h"
#include "core/dom/ExecutionContext.h"
#include "core/dom/ScriptForbiddenScope.h"
@@ -59,11 +60,16 @@ namespace WebCore {
class V8RecursionScope {
WTF_MAKE_NONCOPYABLE(V8RecursionScope);
public:
- V8RecursionScope(v8::Isolate* isolate, ExecutionContext* context)
+ V8RecursionScope(v8::Isolate* isolate, ExecutionContext* context, bool shouldTrackStackDepth = true)
: m_isolate(isolate)
, m_executionContext(context)
+ , m_shouldTrackStackDepth(shouldTrackStackDepth)
{
- V8PerIsolateData::from(m_isolate)->incrementRecursionLevel();
+ V8PerIsolateData* isolateData = V8PerIsolateData::from(m_isolate);
+
+ if (shouldTrackStackDepth)
+ trackStackDepth(isolateData);
+ isolateData->incrementRecursionLevel();
ASSERT(!ScriptForbiddenScope::isScriptForbidden());
// If you want V8 to autorun microtasks, this class needs to have a
// v8::Isolate::SuppressMicrotaskExecutionScope member.
@@ -72,7 +78,10 @@ public:
~V8RecursionScope()
{
- if (!V8PerIsolateData::from(m_isolate)->decrementRecursionLevel())
+ V8PerIsolateData* isolateData = V8PerIsolateData::from(m_isolate);
+ if (m_shouldTrackStackDepth)
+ isolateData->stackTraceTimestampTracker()->decrementRecursionLevel();
+ if (isolateData->decrementRecursionLevel())
didLeaveScriptContext();
}
@@ -116,11 +125,13 @@ public:
private:
void didLeaveScriptContext();
+ void trackStackDepth(V8PerIsolateData*);
v8::Isolate* m_isolate;
// FIXME: This is a reference in upstream Blink. In Dartium, it can
// be null when instantiated from a DartUtilities::V8Scope.
ExecutionContext* m_executionContext;
+ bool m_shouldTrackStackDepth;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698