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

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..54cf8b4a7be14fd66873f80820549809c99c921c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
@@ -52,6 +52,14 @@ class SecurityOrigin;
// persist between navigations.
class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> {
public:
+ // A valid transition is from ContextUninitialized to ContextInitialized,
+ // and then ContextDetached. Other transitions are forbidden.
+ enum class Lifecycle {
Yuki 2017/01/06 12:56:56 nit: We can move this into private: section?
+ ContextUninitialized,
+ ContextInitialized,
+ ContextDetached,
+ };
+
static WindowProxy* create(v8::Isolate*, Frame*, DOMWrapperWorld&);
~WindowProxy();
@@ -72,9 +80,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();
@@ -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