Chromium Code Reviews| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 , m_opener(0) | 224 , m_opener(0) |
| 225 , m_openedFrameTracker(new OpenedFrameTracker) | 225 , m_openedFrameTracker(new OpenedFrameTracker) |
| 226 { | 226 { |
| 227 } | 227 } |
| 228 | 228 |
| 229 WebFrame::~WebFrame() | 229 WebFrame::~WebFrame() |
| 230 { | 230 { |
| 231 m_openedFrameTracker.reset(0); | 231 m_openedFrameTracker.reset(0); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void WebFrame::traceChildren(Visitor* visitor, WebFrame* frame) | 234 void WebFrame::traceFrame(Visitor* visitor, WebFrame* frame) |
| 235 { | 235 { |
| 236 #if ENABLE(OILPAN) | 236 #if ENABLE(OILPAN) |
| 237 // Trace the children frames. | 237 if (!frame) |
| 238 WebFrame* child = frame ? frame->firstChild() : 0; | 238 return; |
| 239 while (child) { | |
| 240 if (child->isWebLocalFrame()) | |
| 241 visitor->trace(toWebLocalFrameImpl(child)); | |
| 242 else | |
| 243 visitor->trace(toWebRemoteFrameImpl(child)); | |
| 244 | 239 |
| 245 child = child->nextSibling(); | 240 if (frame->isWebLocalFrame()) |
| 246 } | 241 visitor->trace(toWebLocalFrameImpl(frame)); |
| 242 else | |
| 243 visitor->trace(toWebRemoteFrameImpl(frame)); | |
| 247 #endif | 244 #endif |
| 248 } | 245 } |
| 249 | 246 |
| 247 bool WebFrame::isAlive(Visitor* visitor, WebFrame* frame) | |
| 248 { | |
| 249 #if ENABLE(OILPAN) | |
| 250 if (!frame) | |
| 251 return true; | |
|
haraken
2014/09/24 14:13:04
Shouldn't this be false?
sof
2014/09/24 14:24:34
It could be, I'll move the null check to the call
| |
| 252 | |
| 253 if (frame->isWebLocalFrame()) | |
| 254 return visitor->isAlive(toWebLocalFrameImpl(frame)); | |
| 255 | |
| 256 return visitor->isAlive(toWebRemoteFrameImpl(frame)); | |
| 257 #else | |
|
haraken
2014/09/24 14:13:04
Is it possible that isAlive is called in non-oilpa
sof
2014/09/24 14:24:34
Not possible, but I've resisted the temptation to
haraken
2014/09/24 14:28:51
I'd guess it's allowed.
Even if it's not allowed,
| |
| 258 return true; | |
| 259 #endif | |
| 260 } | |
| 261 | |
| 262 void WebFrame::traceFrames(Visitor* visitor, WebFrame* frame) | |
| 263 { | |
| 264 #if ENABLE(OILPAN) | |
| 265 ASSERT(frame); | |
| 266 traceFrame(visitor, frame->m_parent); | |
| 267 for (WebFrame* child = frame->firstChild(); child; child = child->nextSiblin g()) | |
| 268 traceFrame(visitor, child); | |
| 269 // m_opener is a weak reference. | |
| 270 frame->m_openedFrameTracker->traceFrames(visitor); | |
| 271 #endif | |
| 272 } | |
| 273 | |
| 274 void WebFrame::clearWeakFrames(Visitor* visitor, WebFrame* frame) | |
| 275 { | |
| 276 #if ENABLE(OILPAN) | |
| 277 ASSERT(frame); | |
| 278 if (!isAlive(visitor, frame->m_opener)) | |
| 279 frame->m_opener = nullptr; | |
| 280 #endif | |
| 281 } | |
| 282 | |
| 250 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |