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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.h

Issue 2620313002: Refactor WindowProxy into Local and Remote subclasses. (Closed)
Patch Set: explicit 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/RemoteWindowProxy.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.h
similarity index 42%
copy from third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
copy to third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.h
index 9f074f2b304169e795c11e78e0145236aa167b0a..d85780fc5314d70a4c847fe33fa65b381d15f82b 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/RemoteWindowProxy.h
@@ -28,104 +28,38 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WindowProxy_h
-#define WindowProxy_h
+#ifndef RemoteWindowProxy_h
+#define RemoteWindowProxy_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 "wtf/RefPtr.h"
-#include "wtf/text/AtomicString.h"
+#include "core/frame/RemoteFrame.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 RemoteFrame.
+class RemoteWindowProxy final : public WindowProxy {
public:
- static WindowProxy* create(v8::Isolate*, Frame*, DOMWrapperWorld&);
-
- ~WindowProxy();
- DECLARE_TRACE();
+ static RemoteWindowProxy* create(v8::Isolate* isolate,
+ RemoteFrame& frame,
- v8::Local<v8::Context> contextIfInitialized() const {
- return m_scriptState ? m_scriptState->context() : v8::Local<v8::Context>();
+ RefPtr<DOMWrapperWorld> world) {
+ return new RemoteWindowProxy(isolate, frame, std::move(world));
}
- 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();
-
- 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,
- };
-
- WindowProxy(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
- void initialize();
-
- enum GlobalDetachmentBehavior { DoNotDetachGlobal, DetachGlobal };
- void disposeContext(GlobalDetachmentBehavior);
-
- void setSecurityToken(SecurityOrigin*);
+ RemoteWindowProxy(v8::Isolate*, RemoteFrame&, RefPtr<DOMWrapperWorld>);
- // 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();
-
- // Updates Activity Logger for the current context.
- void updateActivityLogger();
+ void initialize() override;
+ void disposeContext(GlobalDetachmentBehavior) override;
// 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;
};
} // namespace blink
-#endif // WindowProxy_h
+#endif // RemoteWindowProxy_h

Powered by Google App Engine
This is Rietveld 408576698