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" |
11 #include "platform/heap/Handle.h" | |
11 #include "web/OpenedFrameTracker.h" | 12 #include "web/OpenedFrameTracker.h" |
12 #include "web/WebLocalFrameImpl.h" | 13 #include "web/WebLocalFrameImpl.h" |
13 #include "web/WebRemoteFrameImpl.h" | 14 #include "web/WebRemoteFrameImpl.h" |
14 #include <algorithm> | 15 #include <algorithm> |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 Frame* toCoreFrame(const WebFrame* frame) | 19 Frame* toCoreFrame(const WebFrame* frame) |
19 { | 20 { |
20 if (!frame) | 21 if (!frame) |
21 return 0; | 22 return 0; |
22 | 23 |
23 return frame->isWebLocalFrame() | 24 return frame->isWebLocalFrame() |
24 ? static_cast<Frame*>(toWebLocalFrameImpl(frame)->frame()) | 25 ? static_cast<Frame*>(toWebLocalFrameImpl(frame)->frame()) |
25 : toWebRemoteFrameImpl(frame)->frame(); | 26 : toWebRemoteFrameImpl(frame)->frame(); |
26 } | 27 } |
27 | 28 |
28 bool WebFrame::swap(WebFrame* frame) | 29 bool WebFrame::swap(WebFrame* frame) |
29 { | 30 { |
30 using std::swap; | 31 using std::swap; |
31 RefPtr<Frame> oldFrame = toCoreFrame(this); | 32 RefPtrWillBeRawPtr<Frame> oldFrame = toCoreFrame(this); |
32 | 33 |
33 // All child frames must be detached first. | 34 // All child frames must be detached first. |
34 oldFrame->detachChildren(); | 35 oldFrame->detachChildren(); |
35 | 36 |
36 // If the frame has been detached during detaching its children, return | 37 // If the frame has been detached during detaching its children, return |
37 // immediately. | 38 // immediately. |
38 // FIXME: There is no unit test for this condition, so one needs to be | 39 // FIXME: There is no unit test for this condition, so one needs to be |
39 // written. | 40 // written. |
40 if (!oldFrame->host()) | 41 if (!oldFrame->host()) |
41 return false; | 42 return false; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 , m_opener(0) | 224 , m_opener(0) |
224 , m_openedFrameTracker(new OpenedFrameTracker) | 225 , m_openedFrameTracker(new OpenedFrameTracker) |
225 { | 226 { |
226 } | 227 } |
227 | 228 |
228 WebFrame::~WebFrame() | 229 WebFrame::~WebFrame() |
229 { | 230 { |
230 m_openedFrameTracker.reset(0); | 231 m_openedFrameTracker.reset(0); |
231 } | 232 } |
232 | 233 |
234 void WebFrame::traceChildren(Visitor* visitor, WebFrame* frame) | |
Mads Ager (chromium)
2014/09/18 12:00:59
It is probably a good idea to continue to trace th
sof
2014/09/18 13:31:15
Very good point, I hadn't realized the implication
| |
235 { | |
236 #if ENABLE(OILPAN) | |
237 // Trace the children frames. | |
238 WebFrame* child = frame ? frame->firstChild() : 0; | |
239 while (child) { | |
240 if (child->isWebLocalFrame()) | |
241 visitor->trace(toWebLocalFrameImpl(child)); | |
242 else | |
243 visitor->trace(toWebRemoteFrameImpl(child)); | |
244 | |
245 child = child->nextSibling(); | |
246 } | |
247 #endif | |
248 } | |
249 | |
233 } // namespace blink | 250 } // namespace blink |
OLD | NEW |