Chromium Code Reviews| Index: Source/core/frame/Frame.cpp |
| diff --git a/Source/core/frame/Frame.cpp b/Source/core/frame/Frame.cpp |
| index 302a3e1e1328c2dd483c8800fa04416b5323c0b4..7cfa6122bd1c4e176c0b212155e58524e60655ca 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 { |
| @@ -102,6 +103,22 @@ void Frame::trace(Visitor* visitor) |
| visitor->trace(m_domWindow); |
| } |
| +void Frame::detach() |
| +{ |
| + // client() should never be null because that means we somehow re-entered |
|
dcheng
2014/09/25 23:35:43
This was a little hard for me to follow. We needed
Nate Chapin
2014/09/25 23:57:50
It may be that this comment should be on the clien
dcheng
2014/09/26 00:40:25
I'm not sure it really makes sense there either. I
|
| + // the frame detach code... but it is sometimes. |
| + // FIXME: Understand why this is happening so we can document this insanity. |
| + // http://crbug.com/371084 is a probable explanation. |
| + if (!client()) |
| + return; |
| + m_host->decrementFrameCount(); |
| + m_host = nullptr; |
|
dcheng
2014/09/25 23:35:43
I don't think we need to do it in this patch, but
Nate Chapin
2014/09/25 23:57:50
That seems like a good idea for the future.
dcheng
2014/09/26 00:40:25
Mind adding a FIXME?
Nate Chapin
2014/09/26 20:25:51
Now that I look at it, because page() is directly
|
| + // 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 = nullptr; |
| +} |
| + |
| void Frame::detachChildren() |
| { |
| typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector; |
| @@ -206,8 +223,6 @@ void Frame::disconnectOwnerElement() |
| if (m_owner) { |
| if (m_owner->isLocal()) |
| toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); |
| - if (page()) |
| - page()->decrementSubframeCount(); |
| } |
| m_owner = nullptr; |
| } |