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

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

Issue 2702273004: bindings: Simplifies WindowProxyManager and its relation to Frame. (Closed)
Patch Set: Addressed review comments. 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/WindowProxyManager.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h
index a70c384d0242296dd1daa1e7f12bc0ca2fe7d931..ce91c282d63f416678f4aa044906abac39179084 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h
@@ -18,9 +18,8 @@ namespace blink {
class DOMWrapperWorld;
class SecurityOrigin;
-class ScriptController;
-class WindowProxyManagerBase : public GarbageCollected<WindowProxyManagerBase> {
+class WindowProxyManager : public GarbageCollected<WindowProxyManager> {
public:
DECLARE_TRACE();
@@ -34,18 +33,33 @@ class WindowProxyManagerBase : public GarbageCollected<WindowProxyManagerBase> {
void CORE_EXPORT
setGlobals(const HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>&);
+ Frame* frame() const { return m_frame; }
dcheng 2017/02/23 19:02:36 I would personally prefer not to expose this publi
Yuki 2017/03/09 14:58:53 Since this is only used by ScriptController, I rem
+
+ bool isMainWorldProxyInitialized() const {
+ return m_windowProxy->isInitialized();
+ }
+
+ WindowProxy* mainWorldProxy() {
+ m_windowProxy->initializeIfNeeded();
+ return m_windowProxy;
+ }
+
+ WindowProxy* windowProxy(DOMWrapperWorld& world) {
+ WindowProxy* windowProxy = windowProxyMaybeUninitialized(world);
+ windowProxy->initializeIfNeeded();
+ return windowProxy;
+ }
+
protected:
using IsolatedWorldMap = HeapHashMap<int, Member<WindowProxy>>;
- explicit WindowProxyManagerBase(Frame&);
-
- Frame* frame() const { return m_frame; }
- WindowProxy* mainWorldProxy() const { return m_windowProxy.get(); }
- WindowProxy* windowProxy(DOMWrapperWorld&);
+ explicit WindowProxyManager(Frame&);
IsolatedWorldMap& isolatedWorlds() { return m_isolatedWorlds; }
private:
+ WindowProxy* windowProxyMaybeUninitialized(DOMWrapperWorld&);
+
v8::Isolate* const m_isolate;
const Member<Frame> m_frame;
const Member<WindowProxy> m_windowProxy;
@@ -53,13 +67,13 @@ class WindowProxyManagerBase : public GarbageCollected<WindowProxyManagerBase> {
};
template <typename FrameType, typename ProxyType>
-class WindowProxyManagerImplHelper : public WindowProxyManagerBase {
+class WindowProxyManagerImplHelper : public WindowProxyManager {
private:
- using Base = WindowProxyManagerBase;
+ using Base = WindowProxyManager;
public:
FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); }
- ProxyType* mainWorldProxy() const {
+ ProxyType* mainWorldProxy() {
return static_cast<ProxyType*>(Base::mainWorldProxy());
}
ProxyType* windowProxy(DOMWrapperWorld& world) {
@@ -68,7 +82,7 @@ class WindowProxyManagerImplHelper : public WindowProxyManagerBase {
protected:
explicit WindowProxyManagerImplHelper(Frame& frame)
- : WindowProxyManagerBase(frame) {}
+ : WindowProxyManager(frame) {}
};
class LocalWindowProxyManager
@@ -83,9 +97,6 @@ class LocalWindowProxyManager
void updateSecurityOrigin(SecurityOrigin*);
private:
- // TODO(dcheng): Merge LocalWindowProxyManager and ScriptController?
- friend class ScriptController;
-
explicit LocalWindowProxyManager(LocalFrame& frame)
: WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy>(frame) {}
};

Powered by Google App Engine
This is Rietveld 408576698