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

Side by Side Diff: Source/web/WebFrame.cpp

Issue 594483002: Oilpan: extend tracing over WebFrame trees. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve weak callback registration Created 6 years, 2 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 | « Source/web/OpenedFrameTracker.cpp ('k') | Source/web/WebLocalFrameImpl.h » ('j') | 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 "config.h" 5 #include "config.h"
6 #include "public/web/WebFrame.h" 6 #include "public/web/WebFrame.h"
7 7
8 #include "core/frame/RemoteFrame.h" 8 #include "core/frame/RemoteFrame.h"
9 #include "core/html/HTMLFrameOwnerElement.h" 9 #include "core/html/HTMLFrameOwnerElement.h"
10 #include "platform/UserGestureIndicator.h" 10 #include "platform/UserGestureIndicator.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 , m_opener(0) 219 , m_opener(0)
220 , m_openedFrameTracker(new OpenedFrameTracker) 220 , m_openedFrameTracker(new OpenedFrameTracker)
221 { 221 {
222 } 222 }
223 223
224 WebFrame::~WebFrame() 224 WebFrame::~WebFrame()
225 { 225 {
226 m_openedFrameTracker.reset(0); 226 m_openedFrameTracker.reset(0);
227 } 227 }
228 228
229 void WebFrame::traceChildren(Visitor* visitor, WebFrame* frame) 229 #if ENABLE(OILPAN)
230 void WebFrame::traceFrame(Visitor* visitor, WebFrame* frame)
230 { 231 {
231 #if ENABLE(OILPAN) 232 if (!frame)
232 // Trace the children frames. 233 return;
233 WebFrame* child = frame ? frame->firstChild() : 0;
234 while (child) {
235 if (child->isWebLocalFrame())
236 visitor->trace(toWebLocalFrameImpl(child));
237 else
238 visitor->trace(toWebRemoteFrameImpl(child));
239 234
240 child = child->nextSibling(); 235 if (frame->isWebLocalFrame())
241 } 236 visitor->trace(toWebLocalFrameImpl(frame));
242 #endif 237 else
238 visitor->trace(toWebRemoteFrameImpl(frame));
243 } 239 }
244 240
241 void WebFrame::traceFrames(Visitor* visitor, WebFrame* frame)
242 {
243 ASSERT(frame);
244 traceFrame(visitor, frame->m_parent);
245 for (WebFrame* child = frame->firstChild(); child; child = child->nextSiblin g())
246 traceFrame(visitor, child);
247 // m_opener is a weak reference.
248 frame->m_openedFrameTracker->traceFrames(visitor);
249 }
250
251 bool WebFrame::isAlive(Visitor* visitor, WebFrame* frame)
252 {
253 if (!frame)
254 return true;
255
256 if (frame->isWebLocalFrame())
257 return visitor->isAlive(toWebLocalFrameImpl(frame));
258
259 return visitor->isAlive(toWebRemoteFrameImpl(frame));
260 }
261
262 void WebFrame::clearWeakFrames(Visitor* visitor)
263 {
264 if (!isAlive(visitor, m_opener))
265 m_opener = nullptr;
266 }
267 #endif
268
245 } // namespace blink 269 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/OpenedFrameTracker.cpp ('k') | Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698