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/V8PerIsolateData.h

Issue 2764953002: WIP: Entry realm stack in Blink
Patch Set: Created 3 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.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
index 17d08c74f148512e7c4658abccb6ca99c46c430f..26674080b389c6d0e43a31e6db0e78792016fecd 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
@@ -90,6 +90,25 @@ class CORE_EXPORT V8PerIsolateData {
const bool m_originalUseCounterDisabled;
};
+ class EntryRealmScope {
+ STACK_ALLOCATED();
+
+ public:
+ explicit EntryRealmScope(V8PerIsolateData* perIsolateData,
+ v8::Local<v8::Context> entryContext)
+ : m_perIsolateData(perIsolateData),
+ m_previousEntryContext(m_perIsolateData->m_entryContext) {
+ m_perIsolateData->m_entryContext = entryContext;
+ }
+ ~EntryRealmScope() {
+ m_perIsolateData->m_entryContext = m_previousEntryContext;
+ }
+
+ private:
+ V8PerIsolateData* m_perIsolateData;
+ v8::Local<v8::Context> m_previousEntryContext;
+ };
+
// Use this class to abstract away types of members that are pointers to core/
// objects, which are simply owned and released by V8PerIsolateData (see
// m_threadDebugger for an example).
@@ -132,6 +151,13 @@ class CORE_EXPORT V8PerIsolateData {
bool isUseCounterDisabled() const { return m_useCounterDisabled; }
+ v8::Local<v8::Context> entryContext() {
+ DCHECK(!m_entryContext.IsEmpty());
+ if (m_entryContext.IsEmpty())
+ return isolate()->GetEnteredContext();
+ return m_entryContext;
+ }
+
V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); }
V8PrivateProperty* privateProperty() { return m_privateProperty.get(); }
@@ -250,6 +276,9 @@ class CORE_EXPORT V8PerIsolateData {
bool m_useCounterDisabled;
friend class UseCounterDisabledScope;
+ v8::Local<v8::Context> m_entryContext;
+ friend class EntryRealmScope;
+
bool m_isHandlingRecursionLevelError;
bool m_isReportingException;

Powered by Google App Engine
This is Rietveld 408576698