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