OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 , m_client(client) | 64 , m_client(client) |
65 , m_remotePlatformLayer(0) | 65 , m_remotePlatformLayer(0) |
66 { | 66 { |
67 ASSERT(page()); | 67 ASSERT(page()); |
68 | 68 |
69 #ifndef NDEBUG | 69 #ifndef NDEBUG |
70 frameCounter.increment(); | 70 frameCounter.increment(); |
71 #endif | 71 #endif |
72 | 72 |
73 if (m_owner) { | 73 if (m_owner) { |
74 page()->incrementSubframeCount(); | |
75 if (m_owner->isLocal()) | 74 if (m_owner->isLocal()) |
76 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); | 75 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); |
77 } else { | 76 } else { |
78 page()->setMainFrame(this); | 77 page()->setMainFrame(this); |
79 } | 78 } |
80 } | 79 } |
81 | 80 |
82 Frame::~Frame() | 81 Frame::~Frame() |
83 { | 82 { |
84 #if ENABLE(OILPAN) | 83 #if ENABLE(OILPAN) |
(...skipping 10 matching lines...) Expand all Loading... |
95 } | 94 } |
96 | 95 |
97 void Frame::trace(Visitor* visitor) | 96 void Frame::trace(Visitor* visitor) |
98 { | 97 { |
99 visitor->trace(m_treeNode); | 98 visitor->trace(m_treeNode); |
100 visitor->trace(m_host); | 99 visitor->trace(m_host); |
101 visitor->trace(m_owner); | 100 visitor->trace(m_owner); |
102 visitor->trace(m_domWindow); | 101 visitor->trace(m_domWindow); |
103 } | 102 } |
104 | 103 |
| 104 void Frame::detach() |
| 105 { |
| 106 // client() should never be null because that means we somehow re-entered |
| 107 // the frame detach code... but it is sometimes. |
| 108 // FIXME: Understand why this is happening so we can document this insanity. |
| 109 // http://crbug.com/371084 is a probable explanation. |
| 110 if (!client()) |
| 111 return; |
| 112 // After this, we must no longer talk to the client since this clears |
| 113 // its owning reference back to our owning LocalFrame. |
| 114 m_client->detached(); |
| 115 m_client = nullptr; |
| 116 m_host = nullptr; |
| 117 } |
| 118 |
105 void Frame::detachChildren() | 119 void Frame::detachChildren() |
106 { | 120 { |
107 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; | 121 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; |
108 FrameVector childrenToDetach; | 122 FrameVector childrenToDetach; |
109 childrenToDetach.reserveCapacity(tree().childCount()); | 123 childrenToDetach.reserveCapacity(tree().childCount()); |
110 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) | 124 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) |
111 childrenToDetach.append(child); | 125 childrenToDetach.append(child); |
112 FrameVector::iterator end = childrenToDetach.end(); | 126 FrameVector::iterator end = childrenToDetach.end(); |
113 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) | 127 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) |
114 (*it)->detach(); | 128 (*it)->detach(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return true; | 213 return true; |
200 | 214 |
201 return tree().parent()->isRemoteFrame(); | 215 return tree().parent()->isRemoteFrame(); |
202 } | 216 } |
203 | 217 |
204 void Frame::disconnectOwnerElement() | 218 void Frame::disconnectOwnerElement() |
205 { | 219 { |
206 if (m_owner) { | 220 if (m_owner) { |
207 if (m_owner->isLocal()) | 221 if (m_owner->isLocal()) |
208 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); | 222 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); |
209 if (page()) | |
210 page()->decrementSubframeCount(); | |
211 } | 223 } |
212 m_owner = nullptr; | 224 m_owner = nullptr; |
213 } | 225 } |
214 | 226 |
215 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const | 227 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const |
216 { | 228 { |
217 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; | 229 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; |
218 } | 230 } |
219 | 231 |
220 } // namespace blink | 232 } // namespace blink |
OLD | NEW |