Index: third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.h |
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.h |
similarity index 59% |
copy from third_party/WebKit/Source/bindings/core/v8/WindowProxy.h |
copy to third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.h |
index 9f074f2b304169e795c11e78e0145236aa167b0a..e92aea290acfb9fc385fc9507c4a02df132f54e5 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.h |
@@ -28,39 +28,29 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef WindowProxy_h |
-#define WindowProxy_h |
+#ifndef LocalWindowProxy_h |
+#define LocalWindowProxy_h |
#include "bindings/core/v8/DOMWrapperWorld.h" |
-#include "bindings/core/v8/ScopedPersistent.h" |
-#include "bindings/core/v8/ScriptState.h" |
-#include "platform/heap/Handle.h" |
-#include "platform/weborigin/SecurityOrigin.h" |
-#include "wtf/HashMap.h" |
-#include "wtf/PassRefPtr.h" |
+#include "bindings/core/v8/WindowProxy.h" |
+#include "core/frame/LocalFrame.h" |
#include "wtf/RefPtr.h" |
#include "wtf/text/AtomicString.h" |
#include <v8.h> |
namespace blink { |
-class Frame; |
class HTMLDocument; |
class SecurityOrigin; |
-// WindowProxy represents all the per-global object state for a Frame that |
-// persist between navigations. |
-class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { |
+// Subclass of WindowProxy that only handles LocalFrame. |
+class LocalWindowProxy final : public WindowProxy { |
public: |
- static WindowProxy* create(v8::Isolate*, Frame*, DOMWrapperWorld&); |
- |
- ~WindowProxy(); |
- DECLARE_TRACE(); |
- |
- v8::Local<v8::Context> contextIfInitialized() const { |
- return m_scriptState ? m_scriptState->context() : v8::Local<v8::Context>(); |
+ static LocalWindowProxy* create(v8::Isolate* isolate, |
+ LocalFrame& frame, |
+ RefPtr<DOMWrapperWorld> world) { |
+ return new LocalWindowProxy(isolate, frame, std::move(world)); |
} |
- ScriptState* getScriptState() const { return m_scriptState.get(); } |
// Update document object of the frame. |
void updateDocument(); |
@@ -72,31 +62,17 @@ class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { |
// (e.g., after setting docoument.domain). |
void updateSecurityOrigin(SecurityOrigin*); |
- void initializeIfNeeded(); |
- |
- void clearForNavigation(); |
- void clearForClose(); |
- |
- v8::Local<v8::Object> globalIfNotDetached(); |
- v8::Local<v8::Object> releaseGlobal(); |
- void setGlobal(v8::Local<v8::Object>); |
- |
- 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, |
- }; |
+ LocalWindowProxy(v8::Isolate*, LocalFrame&, RefPtr<DOMWrapperWorld>); |
- WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); |
- void initialize(); |
+ void initialize() override; |
+ void disposeContext(GlobalDetachmentBehavior) override; |
- enum GlobalDetachmentBehavior { DoNotDetachGlobal, DetachGlobal }; |
- void disposeContext(GlobalDetachmentBehavior); |
+ // Creates a new v8::Context with the window wrapper object as the global |
+ // object (aka the inner global). Note that the window wrapper and its |
+ // prototype chain do not get fully initialized yet, e.g. the window |
+ // wrapper is not yet associated with the native DOMWindow object. |
+ void createContext(); |
void setSecurityToken(SecurityOrigin*); |
@@ -108,24 +84,9 @@ class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { |
// Updates Activity Logger for the current context. |
void updateActivityLogger(); |
- // Creates a new v8::Context with the window wrapper object as the global |
- // object (aka the inner global). Note that the window wrapper and its |
- // prototype chain do not get fully initialized yet, e.g. the window |
- // wrapper is not yet associated with the native DOMWindow object. |
- void createContext(); |
- |
- // Associates the window wrapper and its prototype chain with the native |
- // DOMWindow object. Also does some more Window-specific initialization. |
- void setupWindowPrototypeChain(); |
- |
- Member<Frame> m_frame; |
- v8::Isolate* m_isolate; |
- RefPtr<ScriptState> m_scriptState; |
- RefPtr<DOMWrapperWorld> m_world; |
- ScopedPersistent<v8::Object> m_globalProxy; |
- Lifecycle m_lifecycle; |
+ LocalFrame* frame() const { return toLocalFrame(WindowProxy::frame()); } |
}; |
} // namespace blink |
-#endif // WindowProxy_h |
+#endif // LocalWindowProxy_h |