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

Side by Side Diff: third_party/WebKit/Source/core/frame/RemoteFrame.cpp

Issue 2626403002: Move Frame pointer to be held by DOMWindow base class. (Closed)
Patch Set: . 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/RemoteDOMWindow.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (!client()) 96 if (!client())
97 return; 97 return;
98 98
99 // Clean up the frame's view if needed. A remote frame only has a view if 99 // Clean up the frame's view if needed. A remote frame only has a view if
100 // the parent is a local frame. 100 // the parent is a local frame.
101 if (m_view) 101 if (m_view)
102 m_view->dispose(); 102 m_view->dispose();
103 client()->willBeDetached(); 103 client()->willBeDetached();
104 m_windowProxyManager->clearForClose(); 104 m_windowProxyManager->clearForClose();
105 setView(nullptr); 105 setView(nullptr);
106 // ... the RemoteDOMWindow will need to be informed of detachment,
107 // as otherwise it will keep a strong reference back to this RemoteFrame.
108 // That combined with wrappers (owned and kept alive by RemoteFrame) keeping
109 // persistent strong references to RemoteDOMWindow will prevent the GCing
110 // of all these objects. Break the cycle by notifying of detachment.
111 toRemoteDOMWindow(m_domWindow)->frameDetached();
dcheng 2017/01/13 03:38:22 I moved this out of setView() because it seems a l
106 if (m_webLayer) 112 if (m_webLayer)
107 setWebLayer(nullptr); 113 setWebLayer(nullptr);
108 Frame::detach(type); 114 Frame::detach(type);
109 } 115 }
110 116
111 bool RemoteFrame::prepareForCommit() { 117 bool RemoteFrame::prepareForCommit() {
112 detachChildren(); 118 detachChildren();
113 return !!host(); 119 return !!host();
114 } 120 }
115 121
(...skipping 21 matching lines...) Expand all
137 143
138 void RemoteFrame::visibilityChanged(bool visible) { 144 void RemoteFrame::visibilityChanged(bool visible) {
139 if (client()) 145 if (client())
140 client()->visibilityChanged(visible); 146 client()->visibilityChanged(visible);
141 } 147 }
142 148
143 void RemoteFrame::setView(RemoteFrameView* view) { 149 void RemoteFrame::setView(RemoteFrameView* view) {
144 // Oilpan: as RemoteFrameView performs no finalization actions, 150 // Oilpan: as RemoteFrameView performs no finalization actions,
145 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) 151 // no explicit dispose() of it needed here. (cf. FrameView::dispose().)
146 m_view = view; 152 m_view = view;
147
148 // ... the RemoteDOMWindow will need to be informed of detachment,
149 // as otherwise it will keep a strong reference back to this RemoteFrame.
150 // That combined with wrappers (owned and kept alive by RemoteFrame) keeping
151 // persistent strong references to RemoteDOMWindow will prevent the GCing
152 // of all these objects. Break the cycle by notifying of detachment.
153 if (!m_view)
154 toRemoteDOMWindow(m_domWindow)->frameDetached();
155 } 153 }
156 154
157 void RemoteFrame::createView() { 155 void RemoteFrame::createView() {
158 // If the RemoteFrame does not have a LocalFrame parent, there's no need to 156 // If the RemoteFrame does not have a LocalFrame parent, there's no need to
159 // create a widget for it. 157 // create a widget for it.
160 if (!deprecatedLocalOwner()) 158 if (!deprecatedLocalOwner())
161 return; 159 return;
162 160
163 ASSERT(!deprecatedLocalOwner()->ownedWidget()); 161 ASSERT(!deprecatedLocalOwner()->ownedWidget());
164 162
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 FrameVector childrenToDetach; 194 FrameVector childrenToDetach;
197 childrenToDetach.reserveCapacity(tree().childCount()); 195 childrenToDetach.reserveCapacity(tree().childCount());
198 for (Frame* child = tree().firstChild(); child; 196 for (Frame* child = tree().firstChild(); child;
199 child = child->tree().nextSibling()) 197 child = child->tree().nextSibling())
200 childrenToDetach.push_back(child); 198 childrenToDetach.push_back(child);
201 for (const auto& child : childrenToDetach) 199 for (const auto& child : childrenToDetach)
202 child->detach(FrameDetachType::Remove); 200 child->detach(FrameDetachType::Remove);
203 } 201 }
204 202
205 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/RemoteDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698