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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 using namespace HTMLNames; | 56 using namespace HTMLNames; |
57 | 57 |
58 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame")); | 58 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame")); |
59 | 59 |
60 Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner) | 60 Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner) |
61 : m_treeNode(this) | 61 : m_treeNode(this) |
62 , m_host(host) | 62 , m_host(host) |
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 , m_hasBeenClosed(false) |
66 { | 67 { |
67 ASSERT(page()); | 68 ASSERT(page()); |
68 | 69 |
69 #ifndef NDEBUG | 70 #ifndef NDEBUG |
70 frameCounter.increment(); | 71 frameCounter.increment(); |
71 #endif | 72 #endif |
72 | 73 |
73 if (m_owner) { | 74 if (m_owner) { |
74 page()->incrementSubframeCount(); | 75 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 { |
| 85 // FIXME: We should not be doing all this work inside the destructor |
| 86 dispose(); |
| 87 } |
| 88 |
| 89 void Frame::dispose() |
| 90 { |
| 91 #if ENABLE(OILPAN) |
| 92 ASSERT(!m_owner); |
| 93 #else |
84 disconnectOwnerElement(); | 94 disconnectOwnerElement(); |
85 setDOMWindow(nullptr); | 95 setDOMWindow(nullptr); |
86 | 96 #endif |
87 // FIXME: We should not be doing all this work inside the destructor | |
88 | 97 |
89 #ifndef NDEBUG | 98 #ifndef NDEBUG |
90 frameCounter.decrement(); | 99 frameCounter.decrement(); |
91 #endif | 100 #endif |
92 } | 101 } |
93 | 102 |
| 103 void Frame::trace(Visitor* visitor) |
| 104 { |
| 105 visitor->trace(m_treeNode); |
| 106 visitor->trace(m_host); |
| 107 visitor->trace(m_owner); |
| 108 visitor->trace(m_domWindow); |
| 109 } |
| 110 |
94 void Frame::detachChildren() | 111 void Frame::detachChildren() |
95 { | 112 { |
96 typedef Vector<RefPtr<Frame> > FrameVector; | 113 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; |
97 FrameVector childrenToDetach; | 114 FrameVector childrenToDetach; |
98 childrenToDetach.reserveCapacity(tree().childCount()); | 115 childrenToDetach.reserveCapacity(tree().childCount()); |
99 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) | 116 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi
bling()) |
100 childrenToDetach.append(child); | 117 childrenToDetach.append(child); |
101 FrameVector::iterator end = childrenToDetach.end(); | 118 FrameVector::iterator end = childrenToDetach.end(); |
102 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) | 119 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) |
103 (*it)->detach(); | 120 (*it)->detach(); |
104 } | 121 } |
105 | 122 |
106 FrameHost* Frame::host() const | 123 FrameHost* Frame::host() const |
(...skipping 12 matching lines...) Expand all Loading... |
119 { | 136 { |
120 if (m_host) | 137 if (m_host) |
121 return &m_host->settings(); | 138 return &m_host->settings(); |
122 return 0; | 139 return 0; |
123 } | 140 } |
124 | 141 |
125 void Frame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) | 142 void Frame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) |
126 { | 143 { |
127 if (m_domWindow) | 144 if (m_domWindow) |
128 m_domWindow->reset(); | 145 m_domWindow->reset(); |
| 146 |
129 m_domWindow = domWindow; | 147 m_domWindow = domWindow; |
130 } | 148 } |
131 | 149 |
132 static ChromeClient& emptyChromeClient() | 150 static ChromeClient& emptyChromeClient() |
133 { | 151 { |
134 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, ()); | 152 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, ()); |
135 return client; | 153 return client; |
136 } | 154 } |
137 | 155 |
138 ChromeClient& Frame::chromeClient() const | 156 ChromeClient& Frame::chromeClient() const |
(...skipping 12 matching lines...) Expand all Loading... |
151 return 0; | 169 return 0; |
152 // FIXME: If <object> is ever fixed to disassociate itself from frames | 170 // FIXME: If <object> is ever fixed to disassociate itself from frames |
153 // that it has started but canceled, then this can turn into an ASSERT | 171 // that it has started but canceled, then this can turn into an ASSERT |
154 // since ownerElement() would be 0 when the load is canceled. | 172 // since ownerElement() would be 0 when the load is canceled. |
155 // https://bugs.webkit.org/show_bug.cgi?id=18585 | 173 // https://bugs.webkit.org/show_bug.cgi?id=18585 |
156 if (!object->isRenderPart()) | 174 if (!object->isRenderPart()) |
157 return 0; | 175 return 0; |
158 return toRenderPart(object); | 176 return toRenderPart(object); |
159 } | 177 } |
160 | 178 |
161 void Frame::setRemotePlatformLayer(blink::WebLayer* layer) | 179 void Frame::setRemotePlatformLayer(WebLayer* layer) |
162 { | 180 { |
163 if (m_remotePlatformLayer) | 181 if (m_remotePlatformLayer) |
164 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer); | 182 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer); |
165 m_remotePlatformLayer = layer; | 183 m_remotePlatformLayer = layer; |
166 if (m_remotePlatformLayer) | 184 if (m_remotePlatformLayer) |
167 GraphicsLayer::registerContentsLayer(layer); | 185 GraphicsLayer::registerContentsLayer(layer); |
168 | 186 |
169 ASSERT(owner()); | 187 ASSERT(owner()); |
170 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); | 188 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); |
171 if (RenderPart* renderer = ownerRenderer()) | 189 if (RenderPart* renderer = ownerRenderer()) |
(...skipping 18 matching lines...) Expand all Loading... |
190 } | 208 } |
191 | 209 |
192 void Frame::disconnectOwnerElement() | 210 void Frame::disconnectOwnerElement() |
193 { | 211 { |
194 if (m_owner) { | 212 if (m_owner) { |
195 if (m_owner->isLocal()) | 213 if (m_owner->isLocal()) |
196 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); | 214 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); |
197 if (page()) | 215 if (page()) |
198 page()->decrementSubframeCount(); | 216 page()->decrementSubframeCount(); |
199 } | 217 } |
200 m_owner = 0; | 218 m_owner = nullptr; |
201 } | 219 } |
202 | 220 |
203 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const | 221 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const |
204 { | 222 { |
205 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; | 223 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; |
206 } | 224 } |
207 | 225 |
208 } // namespace blink | 226 } // namespace blink |
OLD | NEW |