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

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

Issue 2630693002: Make ScriptController inherit LocalWindowProxyManager
Patch Set: Add comments 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/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..3fb65a6f04a183cad6ce573e0fbdc8629f8be162 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h
@@ -17,22 +17,19 @@
namespace blink {
class DOMWrapperWorld;
-class SecurityOrigin;
-class ScriptController;
-class WindowProxyManagerBase : public GarbageCollected<WindowProxyManagerBase> {
+class CORE_EXPORT WindowProxyManagerBase
+ : public GarbageCollected<WindowProxyManagerBase> {
public:
DECLARE_TRACE();
v8::Isolate* isolate() const { return m_isolate; }
void clearForClose();
- void CORE_EXPORT clearForNavigation();
+ void clearForNavigation();
- void CORE_EXPORT
- releaseGlobals(HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>&);
- void CORE_EXPORT
- setGlobals(const HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>&);
+ void releaseGlobals(HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>&);
+ void setGlobals(const HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>&);
protected:
using IsolatedWorldMap = HeapHashMap<int, Member<WindowProxy>>;
@@ -41,11 +38,13 @@ class WindowProxyManagerBase : public GarbageCollected<WindowProxyManagerBase> {
Frame* frame() const { return m_frame; }
WindowProxy* mainWorldProxy() const { return m_windowProxy.get(); }
- WindowProxy* windowProxy(DOMWrapperWorld&);
-
IsolatedWorldMap& isolatedWorlds() { return m_isolatedWorlds; }
+ WindowProxy* windowProxy(DOMWrapperWorld&);
+
private:
+ WindowProxy* possiblyUninitializedWindowProxy(DOMWrapperWorld&);
+
v8::Isolate* const m_isolate;
const Member<Frame> m_frame;
const Member<WindowProxy> m_windowProxy;
@@ -58,10 +57,12 @@ class WindowProxyManagerImplHelper : public WindowProxyManagerBase {
using Base = WindowProxyManagerBase;
public:
- FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); }
+ // Note that this may return an uninitialized WindowProxy.
Yuki 2017/01/13 10:42:00 This is a very good comment, but could you write t
dcheng 2017/01/13 18:57:31 Done.
ProxyType* mainWorldProxy() const {
return static_cast<ProxyType*>(Base::mainWorldProxy());
}
+ // Returns the WindowProxy corresponding to |world|. The returned WindowProxy
+ // is guaranteed to be initialized.
Yuki 2017/01/13 10:42:00 Ditto.
dcheng 2017/01/13 18:57:30 Done.
ProxyType* windowProxy(DOMWrapperWorld& world) {
return static_cast<ProxyType*>(Base::windowProxy(world));
}
@@ -69,23 +70,13 @@ class WindowProxyManagerImplHelper : public WindowProxyManagerBase {
protected:
explicit WindowProxyManagerImplHelper(Frame& frame)
: WindowProxyManagerBase(frame) {}
+
+ FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); }
};
class LocalWindowProxyManager
: public WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy> {
- public:
- static LocalWindowProxyManager* create(LocalFrame& frame) {
- return new LocalWindowProxyManager(frame);
- }
-
- // Sets the given security origin to the main world's context. Also updates
- // the security origin of the context for each isolated world.
- void updateSecurityOrigin(SecurityOrigin*);
-
- private:
- // TODO(dcheng): Merge LocalWindowProxyManager and ScriptController?
- friend class ScriptController;
-
+ protected:
explicit LocalWindowProxyManager(LocalFrame& frame)
: WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy>(frame) {}
};

Powered by Google App Engine
This is Rietveld 408576698