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 #if ENABLE(OILPAN) | |
| 67 , m_hasBeenClosed(false) | |
| 68 #endif | |
| 66 { | 69 { |
| 67 ASSERT(page()); | 70 ASSERT(page()); |
| 68 | 71 |
| 69 #ifndef NDEBUG | 72 #ifndef NDEBUG |
| 70 frameCounter.increment(); | 73 frameCounter.increment(); |
| 71 #endif | 74 #endif |
| 72 | 75 |
| 73 if (m_owner) { | 76 if (m_owner) { |
| 74 page()->incrementSubframeCount(); | 77 page()->incrementSubframeCount(); |
| 75 if (m_owner->isLocal()) | 78 if (m_owner->isLocal()) |
| 76 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); | 79 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); |
| 77 } else { | 80 } else { |
| 78 page()->setMainFrame(this); | 81 page()->setMainFrame(this); |
| 79 } | 82 } |
| 80 } | 83 } |
| 81 | 84 |
| 82 Frame::~Frame() | 85 Frame::~Frame() |
| 83 { | 86 { |
| 87 // FIXME: We should not be doing all this work inside the destructor | |
| 88 dispose(); | |
|
haraken
2014/09/08 07:25:58
Shall we rewrite this to:
#if ENABLE(OILPAN)
AS
sof
2014/09/08 21:17:45
I've added that as an Oilpan assert (in dispose())
sof
2014/09/11 13:27:05
This turned out a step too far -- "non local" Fram
| |
| 89 } | |
| 90 | |
| 91 void Frame::dispose() | |
| 92 { | |
| 93 #if !ENABLE(OILPAN) | |
|
dcheng
2014/09/07 22:26:33
Why is this block no longer needed with Oilpan? It
sof
2014/09/08 21:17:45
It is handled implicitly upon the next GC; LocalDO
| |
| 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_owner); | |
| 107 visitor->trace(m_domWindow); | |
| 108 } | |
| 109 | |
| 94 void Frame::detachChildren() | 110 void Frame::detachChildren() |
| 95 { | 111 { |
| 96 typedef Vector<RefPtr<Frame> > FrameVector; | 112 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; |
| 97 FrameVector childrenToDetach; | 113 FrameVector childrenToDetach; |
| 98 childrenToDetach.reserveCapacity(tree().childCount()); | 114 childrenToDetach.reserveCapacity(tree().childCount()); |
| 99 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) | 115 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) |
| 100 childrenToDetach.append(child); | 116 childrenToDetach.append(child); |
| 101 FrameVector::iterator end = childrenToDetach.end(); | 117 FrameVector::iterator end = childrenToDetach.end(); |
| 102 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) | 118 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) |
| 103 (*it)->detach(); | 119 (*it)->detach(); |
| 104 } | 120 } |
| 105 | 121 |
| 106 FrameHost* Frame::host() const | 122 FrameHost* Frame::host() const |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 119 { | 135 { |
| 120 if (m_host) | 136 if (m_host) |
| 121 return &m_host->settings(); | 137 return &m_host->settings(); |
| 122 return 0; | 138 return 0; |
| 123 } | 139 } |
| 124 | 140 |
| 125 void Frame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) | 141 void Frame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) |
| 126 { | 142 { |
| 127 if (m_domWindow) | 143 if (m_domWindow) |
| 128 m_domWindow->reset(); | 144 m_domWindow->reset(); |
| 145 | |
| 129 m_domWindow = domWindow; | 146 m_domWindow = domWindow; |
| 130 } | 147 } |
| 131 | 148 |
| 132 static ChromeClient& emptyChromeClient() | 149 static ChromeClient& emptyChromeClient() |
| 133 { | 150 { |
| 134 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, ()); | 151 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, ()); |
| 135 return client; | 152 return client; |
| 136 } | 153 } |
| 137 | 154 |
| 138 ChromeClient& Frame::chromeClient() const | 155 ChromeClient& Frame::chromeClient() const |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 151 return 0; | 168 return 0; |
| 152 // FIXME: If <object> is ever fixed to disassociate itself from frames | 169 // 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 | 170 // that it has started but canceled, then this can turn into an ASSERT |
| 154 // since ownerElement() would be 0 when the load is canceled. | 171 // since ownerElement() would be 0 when the load is canceled. |
| 155 // https://bugs.webkit.org/show_bug.cgi?id=18585 | 172 // https://bugs.webkit.org/show_bug.cgi?id=18585 |
| 156 if (!object->isRenderPart()) | 173 if (!object->isRenderPart()) |
| 157 return 0; | 174 return 0; |
| 158 return toRenderPart(object); | 175 return toRenderPart(object); |
| 159 } | 176 } |
| 160 | 177 |
| 161 void Frame::setRemotePlatformLayer(blink::WebLayer* layer) | 178 void Frame::setRemotePlatformLayer(WebLayer* layer) |
| 162 { | 179 { |
| 163 if (m_remotePlatformLayer) | 180 if (m_remotePlatformLayer) |
| 164 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer); | 181 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer); |
| 165 m_remotePlatformLayer = layer; | 182 m_remotePlatformLayer = layer; |
| 166 if (m_remotePlatformLayer) | 183 if (m_remotePlatformLayer) |
| 167 GraphicsLayer::registerContentsLayer(layer); | 184 GraphicsLayer::registerContentsLayer(layer); |
| 168 | 185 |
| 169 ASSERT(owner()); | 186 ASSERT(owner()); |
| 170 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); | 187 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); |
| 171 if (RenderPart* renderer = ownerRenderer()) | 188 if (RenderPart* renderer = ownerRenderer()) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 190 } | 207 } |
| 191 | 208 |
| 192 void Frame::disconnectOwnerElement() | 209 void Frame::disconnectOwnerElement() |
| 193 { | 210 { |
| 194 if (m_owner) { | 211 if (m_owner) { |
| 195 if (m_owner->isLocal()) | 212 if (m_owner->isLocal()) |
| 196 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); | 213 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); |
| 197 if (page()) | 214 if (page()) |
| 198 page()->decrementSubframeCount(); | 215 page()->decrementSubframeCount(); |
| 199 } | 216 } |
| 200 m_owner = 0; | 217 m_owner = nullptr; |
| 201 } | 218 } |
| 202 | 219 |
| 203 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const | 220 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const |
| 204 { | 221 { |
| 205 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; | 222 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; |
| 206 } | 223 } |
| 207 | 224 |
| 208 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |