Chromium Code Reviews| 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 9f074f2b304169e795c11e78e0145236aa167b0a..0c2219083fed7695967e031046d48700a9878b03 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h |
| @@ -35,55 +35,43 @@ |
| #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 "wtf/RefPtr.h" |
| -#include "wtf/text/AtomicString.h" |
| #include <v8.h> |
| namespace blink { |
| class Frame; |
| -class HTMLDocument; |
| -class SecurityOrigin; |
| +class ScriptController; |
| // WindowProxy represents all the per-global object state for a Frame that |
| // persist between navigations. |
| -class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { |
| +class WindowProxy : public GarbageCollectedFinalized<WindowProxy> { |
| public: |
| - static WindowProxy* create(v8::Isolate*, Frame*, DOMWrapperWorld&); |
| + virtual ~WindowProxy(); |
| - ~WindowProxy(); |
| DECLARE_TRACE(); |
| v8::Local<v8::Context> contextIfInitialized() const { |
| return m_scriptState ? m_scriptState->context() : v8::Local<v8::Context>(); |
| } |
| - ScriptState* getScriptState() const { return m_scriptState.get(); } |
| - |
| - // Update document object of the frame. |
| - void updateDocument(); |
| - |
| - void namedItemAdded(HTMLDocument*, const AtomicString&); |
| - void namedItemRemoved(HTMLDocument*, const AtomicString&); |
| - |
| - // Update the security origin of a document |
| - // (e.g., after setting docoument.domain). |
| - void updateSecurityOrigin(SecurityOrigin*); |
| - |
| void initializeIfNeeded(); |
| - void clearForNavigation(); |
| void clearForClose(); |
| + void clearForNavigation(); |
| v8::Local<v8::Object> globalIfNotDetached(); |
| v8::Local<v8::Object> releaseGlobal(); |
| void setGlobal(v8::Local<v8::Object>); |
| + // TODO(dcheng): Temporarily exposed to avoid include cycles. Remove the need |
| + // for this and remove this getter. |
| DOMWrapperWorld& world() { return *m_world; } |
| - private: |
| + protected: |
| + // TODO(dcheng): Remove this friend declaration once LocalWindowProxyManager |
| + // and ScriptController are merged. |
| + friend class ScriptController; |
| + |
| // A valid transition is from ContextUninitialized to ContextInitialized, |
| // and then ContextDetached. Other transitions are forbidden. |
| enum class Lifecycle { |
| @@ -92,36 +80,31 @@ class WindowProxy final : public GarbageCollectedFinalized<WindowProxy> { |
| ContextDetached, |
| }; |
| - WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*); |
| - void initialize(); |
| + WindowProxy(Frame&, v8::Isolate*, RefPtr<DOMWrapperWorld>); |
|
Yuki
2017/01/11 10:09:24
nit: Could you put v8::Isolate* first as it's our
dcheng
2017/01/11 10:35:29
Done, here and elsewhere.
|
| - enum GlobalDetachmentBehavior { DoNotDetachGlobal, DetachGlobal }; |
| - void disposeContext(GlobalDetachmentBehavior); |
| - |
| - void setSecurityToken(SecurityOrigin*); |
| - |
| - // The JavaScript wrapper for the document object is cached on the global |
| - // object for fast access. UpdateDocumentProperty sets the wrapper |
| - // for the current document on the global object. |
| - void updateDocumentProperty(); |
| + virtual void initialize() = 0; |
| - // 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(); |
| + enum GlobalDetachmentBehavior { DoNotDetachGlobal, DetachGlobal }; |
| + virtual void disposeContext(GlobalDetachmentBehavior); |
| // 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; |
| + Frame* frame() const { return m_frame.get(); } |
| + v8::Isolate* isolate() const { return m_isolate; } |
| + ScriptState* getScriptState() const { return m_scriptState.get(); } |
| + |
| + private: |
| + const Member<Frame> m_frame; |
| + v8::Isolate* const m_isolate; |
| + |
| + protected: |
|
Yuki
2017/01/11 10:09:24
Could you unify two protected: sections into one?
dcheng
2017/01/11 10:35:29
This is a bit messy right now. However, the reason
|
| + // TODO(dcheng): Move this to LocalWindowProxy once RemoteWindowProxy uses |
| + // remote contexts. |
| RefPtr<ScriptState> m_scriptState; |
| - RefPtr<DOMWrapperWorld> m_world; |
| + // TODO(dcheng): Consider making these private and using getters. |
| + const RefPtr<DOMWrapperWorld> m_world; |
| ScopedPersistent<v8::Object> m_globalProxy; |
| Lifecycle m_lifecycle; |
| }; |