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

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

Issue 2615213002: Introduce a lifecycle model to WindowProxy (Closed)
Patch Set: temp Created 3 years, 11 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/WindowProxy.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
index 7373e0f62f9774c9e338cf43d83d7ae01ddb5092..9f074f2b304169e795c11e78e0145236aa167b0a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
@@ -72,9 +72,6 @@ class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> {
// (e.g., after setting docoument.domain).
void updateSecurityOrigin(SecurityOrigin*);
- bool isContextInitialized() {
- return m_scriptState && !!m_scriptState->perContextData();
- }
void initializeIfNeeded();
void clearForNavigation();
@@ -87,6 +84,14 @@ class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> {
DOMWrapperWorld& world() { return *m_world; }
private:
+ // A valid transition is from ContextUninitialized to ContextInitialized,
+ // and then ContextDetached. Other transitions are forbidden.
+ enum class Lifecycle {
+ ContextUninitialized,
+ ContextInitialized,
+ ContextDetached,
+ };
+
WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
void initialize();
@@ -118,6 +123,7 @@ class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> {
RefPtr<ScriptState> m_scriptState;
RefPtr<DOMWrapperWorld> m_world;
ScopedPersistent<v8::Object> m_globalProxy;
+ Lifecycle m_lifecycle;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698