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

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

Issue 2626183003: Switch RemoteWindowProxy to use v8::Context::NewRemoteContext. (Closed)
Patch Set: . Created 3 years, 10 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/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 9089f013b83894a81d2d280d5737db54716a7745..61d71d978ac6862931042447fde50f4eb2d54050 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxy.h
@@ -31,17 +31,16 @@
#ifndef WindowProxy_h
#define WindowProxy_h
+#include <v8.h>
#include "bindings/core/v8/DOMWrapperWorld.h"
#include "bindings/core/v8/ScopedPersistent.h"
-#include "bindings/core/v8/ScriptState.h"
+#include "core/CoreExport.h"
#include "platform/heap/Handle.h"
#include "wtf/RefPtr.h"
-#include <v8.h>
namespace blink {
class Frame;
-class ScriptController;
// WindowProxy represents all the per-global object state for a Frame that
// persist between navigations.
@@ -51,15 +50,12 @@ class WindowProxy : public GarbageCollectedFinalized<WindowProxy> {
DECLARE_TRACE();
- v8::Local<v8::Context> contextIfInitialized() const {
- return m_scriptState ? m_scriptState->context() : v8::Local<v8::Context>();
- }
void initializeIfNeeded();
void clearForClose();
void clearForNavigation();
- v8::Local<v8::Object> globalIfNotDetached();
+ CORE_EXPORT v8::Local<v8::Object> globalIfNotDetached();
v8::Local<v8::Object> releaseGlobal();
void setGlobal(v8::Local<v8::Object>);
@@ -68,10 +64,6 @@ class WindowProxy : public GarbageCollectedFinalized<WindowProxy> {
DOMWrapperWorld& world() { return *m_world; }
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 {
@@ -85,24 +77,24 @@ class WindowProxy : public GarbageCollectedFinalized<WindowProxy> {
virtual void initialize() = 0;
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();
+ virtual void disposeContext(GlobalDetachmentBehavior) = 0;
v8::Isolate* isolate() const { return m_isolate; }
Frame* frame() const { return m_frame.get(); }
- ScriptState* getScriptState() const { return m_scriptState.get(); }
+
+#if DCHECK_IS_ON()
+ void didAttachGlobalProxy() { m_isGlobalProxyDetached = false; }
+ void didDetachGlobalProxy() { m_isGlobalProxyDetached = true; }
+#endif
private:
v8::Isolate* const m_isolate;
const Member<Frame> m_frame;
+#if DCHECK_IS_ON()
+ bool m_isGlobalProxyDetached = true;
haraken 2017/02/16 01:11:19 I'd prefer renaming this to m_isGlobalProxyAttache
dcheng 2017/02/16 03:14:07 It is possible to combine this into Lifecycle as w
+#endif
protected:
- // TODO(dcheng): Move this to LocalWindowProxy once RemoteWindowProxy uses
- // remote contexts.
- RefPtr<ScriptState> m_scriptState;
// TODO(dcheng): Consider making these private and using getters.
const RefPtr<DOMWrapperWorld> m_world;
ScopedPersistent<v8::Object> m_globalProxy;

Powered by Google App Engine
This is Rietveld 408576698