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