| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/RemoteFrame.h" | 5 #include "core/frame/RemoteFrame.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WindowProxy.h" | 7 #include "bindings/core/v8/WindowProxy.h" |
| 8 #include "bindings/core/v8/WindowProxyManager.h" | 8 #include "bindings/core/v8/WindowProxyManager.h" |
| 9 #include "core/dom/RemoteSecurityContext.h" | 9 #include "core/dom/RemoteSecurityContext.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "platform/weborigin/SecurityPolicy.h" | 23 #include "platform/weborigin/SecurityPolicy.h" |
| 24 #include "public/platform/WebLayer.h" | 24 #include "public/platform/WebLayer.h" |
| 25 | 25 |
| 26 namespace blink { | 26 namespace blink { |
| 27 | 27 |
| 28 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, | 28 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, |
| 29 FrameHost* host, | 29 FrameHost* host, |
| 30 FrameOwner* owner) | 30 FrameOwner* owner) |
| 31 : Frame(client, host, owner), | 31 : Frame(client, host, owner), |
| 32 m_securityContext(RemoteSecurityContext::create()), | 32 m_securityContext(RemoteSecurityContext::create()), |
| 33 m_domWindow(RemoteDOMWindow::create(*this)), | 33 m_windowProxyManager(WindowProxyManager::create(*this)) { |
| 34 m_windowProxyManager(WindowProxyManager::create(*this)) {} | 34 m_domWindow = RemoteDOMWindow::create(*this); |
| 35 } |
| 35 | 36 |
| 36 RemoteFrame* RemoteFrame::create(RemoteFrameClient* client, | 37 RemoteFrame* RemoteFrame::create(RemoteFrameClient* client, |
| 37 FrameHost* host, | 38 FrameHost* host, |
| 38 FrameOwner* owner) { | 39 FrameOwner* owner) { |
| 39 return new RemoteFrame(client, host, owner); | 40 return new RemoteFrame(client, host, owner); |
| 40 } | 41 } |
| 41 | 42 |
| 42 RemoteFrame::~RemoteFrame() { | 43 RemoteFrame::~RemoteFrame() { |
| 43 ASSERT(!m_view); | 44 ASSERT(!m_view); |
| 44 } | 45 } |
| 45 | 46 |
| 46 DEFINE_TRACE(RemoteFrame) { | 47 DEFINE_TRACE(RemoteFrame) { |
| 47 visitor->trace(m_view); | 48 visitor->trace(m_view); |
| 48 visitor->trace(m_securityContext); | 49 visitor->trace(m_securityContext); |
| 49 visitor->trace(m_domWindow); | |
| 50 visitor->trace(m_windowProxyManager); | 50 visitor->trace(m_windowProxyManager); |
| 51 Frame::trace(visitor); | 51 Frame::trace(visitor); |
| 52 } | 52 } |
| 53 | 53 |
| 54 DOMWindow* RemoteFrame::domWindow() const { | |
| 55 return m_domWindow.get(); | |
| 56 } | |
| 57 | |
| 58 WindowProxy* RemoteFrame::windowProxy(DOMWrapperWorld& world) { | 54 WindowProxy* RemoteFrame::windowProxy(DOMWrapperWorld& world) { |
| 59 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world); | 55 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world); |
| 60 ASSERT(windowProxy); | 56 ASSERT(windowProxy); |
| 61 windowProxy->initializeIfNeeded(); | 57 windowProxy->initializeIfNeeded(); |
| 62 return windowProxy; | 58 return windowProxy; |
| 63 } | 59 } |
| 64 | 60 |
| 65 void RemoteFrame::navigate(Document& originDocument, | 61 void RemoteFrame::navigate(Document& originDocument, |
| 66 const KURL& url, | 62 const KURL& url, |
| 67 bool replaceCurrentItem, | 63 bool replaceCurrentItem, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Oilpan: as RemoteFrameView performs no finalization actions, | 144 // Oilpan: as RemoteFrameView performs no finalization actions, |
| 149 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) | 145 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) |
| 150 m_view = view; | 146 m_view = view; |
| 151 | 147 |
| 152 // ... the RemoteDOMWindow will need to be informed of detachment, | 148 // ... the RemoteDOMWindow will need to be informed of detachment, |
| 153 // as otherwise it will keep a strong reference back to this RemoteFrame. | 149 // as otherwise it will keep a strong reference back to this RemoteFrame. |
| 154 // That combined with wrappers (owned and kept alive by RemoteFrame) keeping | 150 // That combined with wrappers (owned and kept alive by RemoteFrame) keeping |
| 155 // persistent strong references to RemoteDOMWindow will prevent the GCing | 151 // persistent strong references to RemoteDOMWindow will prevent the GCing |
| 156 // of all these objects. Break the cycle by notifying of detachment. | 152 // of all these objects. Break the cycle by notifying of detachment. |
| 157 if (!m_view) | 153 if (!m_view) |
| 158 m_domWindow->frameDetached(); | 154 toRemoteDOMWindow(m_domWindow)->frameDetached(); |
| 159 } | 155 } |
| 160 | 156 |
| 161 void RemoteFrame::createView() { | 157 void RemoteFrame::createView() { |
| 162 // If the RemoteFrame does not have a LocalFrame parent, there's no need to | 158 // If the RemoteFrame does not have a LocalFrame parent, there's no need to |
| 163 // create a widget for it. | 159 // create a widget for it. |
| 164 if (!deprecatedLocalOwner()) | 160 if (!deprecatedLocalOwner()) |
| 165 return; | 161 return; |
| 166 | 162 |
| 167 ASSERT(!deprecatedLocalOwner()->ownedWidget()); | 163 ASSERT(!deprecatedLocalOwner()->ownedWidget()); |
| 168 | 164 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 196 FrameVector childrenToDetach; | 192 FrameVector childrenToDetach; |
| 197 childrenToDetach.reserveCapacity(tree().childCount()); | 193 childrenToDetach.reserveCapacity(tree().childCount()); |
| 198 for (Frame* child = tree().firstChild(); child; | 194 for (Frame* child = tree().firstChild(); child; |
| 199 child = child->tree().nextSibling()) | 195 child = child->tree().nextSibling()) |
| 200 childrenToDetach.append(child); | 196 childrenToDetach.append(child); |
| 201 for (const auto& child : childrenToDetach) | 197 for (const auto& child : childrenToDetach) |
| 202 child->detach(FrameDetachType::Remove); | 198 child->detach(FrameDetachType::Remove); |
| 203 } | 199 } |
| 204 | 200 |
| 205 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |