Chromium Code Reviews| Index: Source/core/frame/Frame.cpp |
| diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp |
| index f647b3e5988b5ed202236a17a12183a39112612d..2a9a8f65b859e0bdef877e8811eb2f918e32086d 100644 |
| --- a/Source/core/frame/Frame.cpp |
| +++ b/Source/core/frame/Frame.cpp |
| @@ -70,8 +70,9 @@ Frame::Frame(FrameClient* client, FrameHost* host, FrameOwner* owner) |
| frameCounter.increment(); |
| #endif |
| + m_host->incrementFrameCount(); |
| + |
| if (m_owner) { |
| - page()->incrementSubframeCount(); |
| if (m_owner->isLocal()) |
| toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); |
| } else { |
| @@ -91,6 +92,21 @@ Frame::~Frame() |
| #endif |
| } |
| +void Frame::detach() |
| +{ |
| + // client() should never be null because that means we somehow re-entered |
| + // the frame detach code... but it is sometimes. |
| + // FIXME: Understand why this is happening so we can document this insanity. |
|
dcheng
2014/09/16 19:46:11
I think (but could be wrong) that this is actually
|
| + if (!client()) |
| + return; |
| + m_host->decrementFrameCount(); |
| + m_host = 0; |
| + // After this, we must no longer talk to the client since this clears |
| + // its owning reference back to our owning LocalFrame. |
| + m_client->detached(); |
| + m_client = 0; |
| +} |
| + |
| void Frame::detachChildren() |
| { |
| typedef Vector<RefPtr<Frame> > FrameVector; |
| @@ -194,8 +210,6 @@ void Frame::disconnectOwnerElement() |
| if (m_owner) { |
| if (m_owner->isLocal()) |
| toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); |
| - if (page()) |
| - page()->decrementSubframeCount(); |
| } |
| m_owner = 0; |
| } |