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 "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 Loading... |
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 |
OLD | NEW |