| 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 15 matching lines...) Expand all Loading... |
| 26 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, Fram
eOwner* owner) | 26 inline RemoteFrame::RemoteFrame(RemoteFrameClient* client, FrameHost* host, Fram
eOwner* owner) |
| 27 : Frame(client, host, owner) | 27 : Frame(client, host, owner) |
| 28 , m_view(nullptr) | 28 , m_view(nullptr) |
| 29 , m_securityContext(RemoteSecurityContext::create()) | 29 , m_securityContext(RemoteSecurityContext::create()) |
| 30 , m_domWindow(RemoteDOMWindow::create(*this)) | 30 , m_domWindow(RemoteDOMWindow::create(*this)) |
| 31 , m_windowProxyManager(WindowProxyManager::create(*this)) | 31 , m_windowProxyManager(WindowProxyManager::create(*this)) |
| 32 , m_remotePlatformLayer(nullptr) | 32 , m_remotePlatformLayer(nullptr) |
| 33 { | 33 { |
| 34 } | 34 } |
| 35 | 35 |
| 36 PassRefPtrWillBeRawPtr<RemoteFrame> RemoteFrame::create(RemoteFrameClient* clien
t, FrameHost* host, FrameOwner* owner) | 36 RawPtr<RemoteFrame> RemoteFrame::create(RemoteFrameClient* client, FrameHost* ho
st, FrameOwner* owner) |
| 37 { | 37 { |
| 38 return adoptRefWillBeNoop(new RemoteFrame(client, host, owner)); | 38 return new RemoteFrame(client, host, owner); |
| 39 } | 39 } |
| 40 | 40 |
| 41 RemoteFrame::~RemoteFrame() | 41 RemoteFrame::~RemoteFrame() |
| 42 { | 42 { |
| 43 ASSERT(!m_view); | 43 ASSERT(!m_view); |
| 44 } | 44 } |
| 45 | 45 |
| 46 DEFINE_TRACE(RemoteFrame) | 46 DEFINE_TRACE(RemoteFrame) |
| 47 { | 47 { |
| 48 visitor->trace(m_view); | 48 visitor->trace(m_view); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 { | 85 { |
| 86 remoteFrameClient()->reload(frameLoadType, clientRedirectPolicy); | 86 remoteFrameClient()->reload(frameLoadType, clientRedirectPolicy); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void RemoteFrame::detach(FrameDetachType type) | 89 void RemoteFrame::detach(FrameDetachType type) |
| 90 { | 90 { |
| 91 PluginScriptForbiddenScope forbidPluginDestructorScripting; | 91 PluginScriptForbiddenScope forbidPluginDestructorScripting; |
| 92 // Frame::detach() requires the caller to keep a reference to this, since | 92 // Frame::detach() requires the caller to keep a reference to this, since |
| 93 // otherwise it may clear the last reference to this, causing it to be | 93 // otherwise it may clear the last reference to this, causing it to be |
| 94 // deleted, which can cause a use-after-free. | 94 // deleted, which can cause a use-after-free. |
| 95 RefPtrWillBeRawPtr<RemoteFrame> protect(this); | 95 RawPtr<RemoteFrame> protect(this); |
| 96 detachChildren(); | 96 detachChildren(); |
| 97 if (!client()) | 97 if (!client()) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 // Clean up the frame's view if needed. A remote frame only has a view if | 100 // Clean up the frame's view if needed. A remote frame only has a view if |
| 101 // the parent is a local frame. | 101 // the parent is a local frame. |
| 102 if (m_view) | 102 if (m_view) |
| 103 m_view->dispose(); | 103 m_view->dispose(); |
| 104 client()->willBeDetached(); | 104 client()->willBeDetached(); |
| 105 m_windowProxyManager->clearForClose(); | 105 m_windowProxyManager->clearForClose(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 136 { | 136 { |
| 137 remoteFrameClient()->frameRectsChanged(frameRect); | 137 remoteFrameClient()->frameRectsChanged(frameRect); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void RemoteFrame::visibilityChanged(bool visible) | 140 void RemoteFrame::visibilityChanged(bool visible) |
| 141 { | 141 { |
| 142 if (remoteFrameClient()) | 142 if (remoteFrameClient()) |
| 143 remoteFrameClient()->visibilityChanged(visible); | 143 remoteFrameClient()->visibilityChanged(visible); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void RemoteFrame::setView(PassRefPtrWillBeRawPtr<RemoteFrameView> view) | 146 void RemoteFrame::setView(RawPtr<RemoteFrameView> view) |
| 147 { | 147 { |
| 148 // Oilpan: as RemoteFrameView performs no finalization actions, | 148 // Oilpan: as RemoteFrameView performs no finalization actions, |
| 149 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) | 149 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) |
| 150 m_view = view; | 150 m_view = view; |
| 151 | 151 |
| 152 // ... the RemoteDOMWindow will need to be informed of detachment, | 152 // ... the RemoteDOMWindow will need to be informed of detachment, |
| 153 // as otherwise it will keep a strong reference back to this RemoteFrame. | 153 // as otherwise it will keep a strong reference back to this RemoteFrame. |
| 154 // That combined with wrappers (owned and kept alive by RemoteFrame) keeping | 154 // That combined with wrappers (owned and kept alive by RemoteFrame) keeping |
| 155 // persistent strong references to RemoteDOMWindow will prevent the GCing | 155 // persistent strong references to RemoteDOMWindow will prevent the GCing |
| 156 // of all these objects. Break the cycle by notifying of detachment. | 156 // of all these objects. Break the cycle by notifying of detachment. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ASSERT(owner()); | 189 ASSERT(owner()); |
| 190 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); | 190 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void RemoteFrame::advanceFocus(WebFocusType type, LocalFrame* source) | 193 void RemoteFrame::advanceFocus(WebFocusType type, LocalFrame* source) |
| 194 { | 194 { |
| 195 remoteFrameClient()->advanceFocus(type, source); | 195 remoteFrameClient()->advanceFocus(type, source); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |