Chromium Code Reviews| 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..994dd6f29884e45919809444bd4a1546e50bfff3 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.h |
| @@ -28,39 +28,31 @@ |
| * 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(LocalFrame& frame, |
| + v8::Isolate* isolate, |
| + RefPtr<DOMWrapperWorld> world) { |
| + return new LocalWindowProxy(frame, isolate, std::move(world)); |
| } |
| - ScriptState* getScriptState() const { return m_scriptState.get(); } |
| + |
| + ~LocalWindowProxy() override; |
|
Yuki
2017/01/11 10:09:24
nit: "= default" should work. WindowProxy::~Windo
dcheng
2017/01/11 10:35:28
Removed, since that's equivalent to = default.
|
| // Update document object of the frame. |
| void updateDocument(); |
| @@ -72,31 +64,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(LocalFrame&, v8::Isolate*, 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 +86,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 |