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

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

Issue 1858613002: bindings: Makes the window object be the inner global object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced. Created 4 years, 8 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 ad41c1351981a99f1427539fc7bc4417e772acdd..58230d9ee7ee327ed20a06931f51c993aa203646 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.h
@@ -59,6 +59,31 @@ public:
virtual void run() = 0;
};
+ // Disables the UseCounter.
+ // UseCounter depends on the current context, but it's not available during
+ // the initialization of v8::Context and the global object. So we need to
+ // disable the UseCounter while the initialization of the context and global
+ // object.
+ // TODO(yukishiino): Come up with an idea to remove this hack.
+ class UseCounterDisabledScope {
+ STACK_ALLOCATED();
+ public:
+ explicit UseCounterDisabledScope(V8PerIsolateData* perIsolateData)
+ : m_perIsolateData(perIsolateData)
+ , m_originalUseCounterDisabled(m_perIsolateData->m_useCounterDisabled)
+ {
+ m_perIsolateData->m_useCounterDisabled = true;
+ }
+ ~UseCounterDisabledScope()
+ {
+ m_perIsolateData->m_useCounterDisabled = m_originalUseCounterDisabled;
+ }
+
+ private:
+ V8PerIsolateData* m_perIsolateData;
+ const bool m_originalUseCounterDisabled;
+ };
+
static v8::Isolate* initialize();
static V8PerIsolateData* from(v8::Isolate* isolate)
@@ -117,6 +142,8 @@ private:
V8PerIsolateData();
~V8PerIsolateData();
+ static void useCounterCallback(v8::Isolate*, v8::Isolate::UseCounterFeature);
+
typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> V8FunctionTemplateMap;
V8FunctionTemplateMap& selectInterfaceTemplateMap(const DOMWrapperWorld&);
V8FunctionTemplateMap& selectOperationTemplateMap(const DOMWrapperWorld&);
@@ -142,6 +169,9 @@ private:
bool m_constructorMode;
friend class ConstructorMode;
+ bool m_useCounterDisabled;
+ friend class UseCounterDisabledScope;
+
bool m_isHandlingRecursionLevelError;
bool m_isReportingException;

Powered by Google App Engine
This is Rietveld 408576698