Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 class Frame; | 47 class Frame; |
| 48 class HTMLDocument; | 48 class HTMLDocument; |
| 49 class SecurityOrigin; | 49 class SecurityOrigin; |
| 50 | 50 |
| 51 // WindowProxy represents all the per-global object state for a Frame that | 51 // WindowProxy represents all the per-global object state for a Frame that |
| 52 // persist between navigations. | 52 // persist between navigations. |
| 53 class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { | 53 class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { |
| 54 public: | 54 public: |
| 55 // A valid transition is from ContextUninitialized to ContextInitialized, | |
| 56 // and then ContextDetached. Other transitions are forbidden. | |
| 57 enum class Lifecycle { | |
|
Yuki
2017/01/06 12:56:56
nit: We can move this into private: section?
| |
| 58 ContextUninitialized, | |
| 59 ContextInitialized, | |
| 60 ContextDetached, | |
| 61 }; | |
| 62 | |
| 55 static WindowProxy* create(v8::Isolate*, Frame*, DOMWrapperWorld&); | 63 static WindowProxy* create(v8::Isolate*, Frame*, DOMWrapperWorld&); |
| 56 | 64 |
| 57 ~WindowProxy(); | 65 ~WindowProxy(); |
| 58 DECLARE_TRACE(); | 66 DECLARE_TRACE(); |
| 59 | 67 |
| 60 v8::Local<v8::Context> contextIfInitialized() const { | 68 v8::Local<v8::Context> contextIfInitialized() const { |
| 61 return m_scriptState ? m_scriptState->context() : v8::Local<v8::Context>(); | 69 return m_scriptState ? m_scriptState->context() : v8::Local<v8::Context>(); |
| 62 } | 70 } |
| 63 ScriptState* getScriptState() const { return m_scriptState.get(); } | 71 ScriptState* getScriptState() const { return m_scriptState.get(); } |
| 64 | 72 |
| 65 // Update document object of the frame. | 73 // Update document object of the frame. |
| 66 void updateDocument(); | 74 void updateDocument(); |
| 67 | 75 |
| 68 void namedItemAdded(HTMLDocument*, const AtomicString&); | 76 void namedItemAdded(HTMLDocument*, const AtomicString&); |
| 69 void namedItemRemoved(HTMLDocument*, const AtomicString&); | 77 void namedItemRemoved(HTMLDocument*, const AtomicString&); |
| 70 | 78 |
| 71 // Update the security origin of a document | 79 // Update the security origin of a document |
| 72 // (e.g., after setting docoument.domain). | 80 // (e.g., after setting docoument.domain). |
| 73 void updateSecurityOrigin(SecurityOrigin*); | 81 void updateSecurityOrigin(SecurityOrigin*); |
| 74 | 82 |
| 75 bool isContextInitialized() { | |
| 76 return m_scriptState && !!m_scriptState->perContextData(); | |
| 77 } | |
| 78 void initializeIfNeeded(); | 83 void initializeIfNeeded(); |
| 79 | 84 |
| 80 void clearForNavigation(); | 85 void clearForNavigation(); |
| 81 void clearForClose(); | 86 void clearForClose(); |
| 82 | 87 |
| 83 v8::Local<v8::Object> globalIfNotDetached(); | 88 v8::Local<v8::Object> globalIfNotDetached(); |
| 84 v8::Local<v8::Object> releaseGlobal(); | 89 v8::Local<v8::Object> releaseGlobal(); |
| 85 void setGlobal(v8::Local<v8::Object>); | 90 void setGlobal(v8::Local<v8::Object>); |
| 86 | 91 |
| 87 DOMWrapperWorld& world() { return *m_world; } | 92 DOMWrapperWorld& world() { return *m_world; } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 111 | 116 |
| 112 // Associates the window wrapper and its prototype chain with the native | 117 // Associates the window wrapper and its prototype chain with the native |
| 113 // DOMWindow object. Also does some more Window-specific initialization. | 118 // DOMWindow object. Also does some more Window-specific initialization. |
| 114 void setupWindowPrototypeChain(); | 119 void setupWindowPrototypeChain(); |
| 115 | 120 |
| 116 Member<Frame> m_frame; | 121 Member<Frame> m_frame; |
| 117 v8::Isolate* m_isolate; | 122 v8::Isolate* m_isolate; |
| 118 RefPtr<ScriptState> m_scriptState; | 123 RefPtr<ScriptState> m_scriptState; |
| 119 RefPtr<DOMWrapperWorld> m_world; | 124 RefPtr<DOMWrapperWorld> m_world; |
| 120 ScopedPersistent<v8::Object> m_globalProxy; | 125 ScopedPersistent<v8::Object> m_globalProxy; |
| 126 Lifecycle m_lifecycle; | |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } // namespace blink | 129 } // namespace blink |
| 124 | 130 |
| 125 #endif // WindowProxy_h | 131 #endif // WindowProxy_h |
| OLD | NEW |