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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 , m_owner(owner) | 63 , m_owner(owner) |
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 m_host->incrementFrameCount(); | |
74 | |
73 if (m_owner) { | 75 if (m_owner) { |
74 page()->incrementSubframeCount(); | |
75 if (m_owner->isLocal()) | 76 if (m_owner->isLocal()) |
76 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); | 77 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); |
77 } else { | 78 } else { |
78 page()->setMainFrame(this); | 79 page()->setMainFrame(this); |
79 } | 80 } |
80 } | 81 } |
81 | 82 |
82 Frame::~Frame() | 83 Frame::~Frame() |
83 { | 84 { |
84 #if ENABLE(OILPAN) | 85 #if ENABLE(OILPAN) |
(...skipping 10 matching lines...) Expand all Loading... | |
95 } | 96 } |
96 | 97 |
97 void Frame::trace(Visitor* visitor) | 98 void Frame::trace(Visitor* visitor) |
98 { | 99 { |
99 visitor->trace(m_treeNode); | 100 visitor->trace(m_treeNode); |
100 visitor->trace(m_host); | 101 visitor->trace(m_host); |
101 visitor->trace(m_owner); | 102 visitor->trace(m_owner); |
102 visitor->trace(m_domWindow); | 103 visitor->trace(m_domWindow); |
103 } | 104 } |
104 | 105 |
106 void Frame::detach() | |
107 { | |
108 // client() should never be null because that means we somehow re-entered | |
dcheng
2014/09/25 23:35:43
This was a little hard for me to follow. We needed
Nate Chapin
2014/09/25 23:57:50
It may be that this comment should be on the clien
dcheng
2014/09/26 00:40:25
I'm not sure it really makes sense there either. I
| |
109 // the frame detach code... but it is sometimes. | |
110 // FIXME: Understand why this is happening so we can document this insanity. | |
111 // http://crbug.com/371084 is a probable explanation. | |
112 if (!client()) | |
113 return; | |
114 m_host->decrementFrameCount(); | |
115 m_host = nullptr; | |
dcheng
2014/09/25 23:35:43
I don't think we need to do it in this patch, but
Nate Chapin
2014/09/25 23:57:50
That seems like a good idea for the future.
dcheng
2014/09/26 00:40:25
Mind adding a FIXME?
Nate Chapin
2014/09/26 20:25:51
Now that I look at it, because page() is directly
| |
116 // After this, we must no longer talk to the client since this clears | |
117 // its owning reference back to our owning LocalFrame. | |
118 m_client->detached(); | |
119 m_client = nullptr; | |
120 } | |
121 | |
105 void Frame::detachChildren() | 122 void Frame::detachChildren() |
106 { | 123 { |
107 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; | 124 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; |
108 FrameVector childrenToDetach; | 125 FrameVector childrenToDetach; |
109 childrenToDetach.reserveCapacity(tree().childCount()); | 126 childrenToDetach.reserveCapacity(tree().childCount()); |
110 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) | 127 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) |
111 childrenToDetach.append(child); | 128 childrenToDetach.append(child); |
112 FrameVector::iterator end = childrenToDetach.end(); | 129 FrameVector::iterator end = childrenToDetach.end(); |
113 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) | 130 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) |
114 (*it)->detach(); | 131 (*it)->detach(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 return true; | 216 return true; |
200 | 217 |
201 return tree().parent()->isRemoteFrame(); | 218 return tree().parent()->isRemoteFrame(); |
202 } | 219 } |
203 | 220 |
204 void Frame::disconnectOwnerElement() | 221 void Frame::disconnectOwnerElement() |
205 { | 222 { |
206 if (m_owner) { | 223 if (m_owner) { |
207 if (m_owner->isLocal()) | 224 if (m_owner->isLocal()) |
208 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); | 225 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); |
209 if (page()) | |
210 page()->decrementSubframeCount(); | |
211 } | 226 } |
212 m_owner = nullptr; | 227 m_owner = nullptr; |
213 } | 228 } |
214 | 229 |
215 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const | 230 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const |
216 { | 231 { |
217 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; | 232 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; |
218 } | 233 } |
219 | 234 |
220 } // namespace blink | 235 } // namespace blink |
OLD | NEW |