Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Side by Side Diff: Source/core/frame/Frame.cpp

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back out non-Oilpan experiment + tidy up by adding frame() ref accessors Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 page()->incrementSubframeCount(); 74 page()->incrementSubframeCount();
75 if (m_owner->isLocal()) 75 if (m_owner->isLocal())
76 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this); 76 toHTMLFrameOwnerElement(m_owner)->setContentFrame(*this);
77 } else { 77 } else {
78 page()->setMainFrame(this); 78 page()->setMainFrame(this);
79 } 79 }
80 } 80 }
81 81
82 Frame::~Frame() 82 Frame::~Frame()
83 { 83 {
84 // FIXME: We should not be doing all this work inside the destructor
85 #if !ENABLE(OILPAN)
84 disconnectOwnerElement(); 86 disconnectOwnerElement();
85 setDOMWindow(nullptr); 87 setDOMWindow(nullptr);
86 88 #endif
haraken 2014/09/22 05:35:22 Just help me understand: We don't need to call dis
sof 2014/09/22 08:41:51 Yes, we assume so for local frames. For remote fra
dcheng 2014/09/22 09:15:04 Hm. That seems inconsistent. If you don't mind, ca
87 // FIXME: We should not be doing all this work inside the destructor
88 89
89 #ifndef NDEBUG 90 #ifndef NDEBUG
90 frameCounter.decrement(); 91 frameCounter.decrement();
91 #endif 92 #endif
92 } 93 }
93 94
95 void Frame::trace(Visitor* visitor)
96 {
97 visitor->trace(m_treeNode);
98 visitor->trace(m_host);
99 visitor->trace(m_owner);
100 visitor->trace(m_domWindow);
101 }
102
94 void Frame::detachChildren() 103 void Frame::detachChildren()
95 { 104 {
96 typedef Vector<RefPtr<Frame> > FrameVector; 105 typedef WillBeHeapVector<RefPtrWillBeMember<Frame> > FrameVector;
97 FrameVector childrenToDetach; 106 FrameVector childrenToDetach;
98 childrenToDetach.reserveCapacity(tree().childCount()); 107 childrenToDetach.reserveCapacity(tree().childCount());
99 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling()) 108 for (Frame* child = tree().firstChild(); child; child = child->tree().nextSi bling())
100 childrenToDetach.append(child); 109 childrenToDetach.append(child);
101 FrameVector::iterator end = childrenToDetach.end(); 110 FrameVector::iterator end = childrenToDetach.end();
102 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it) 111 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; ++it)
103 (*it)->detach(); 112 (*it)->detach();
104 } 113 }
105 114
106 FrameHost* Frame::host() const 115 FrameHost* Frame::host() const
(...skipping 12 matching lines...) Expand all
119 { 128 {
120 if (m_host) 129 if (m_host)
121 return &m_host->settings(); 130 return &m_host->settings();
122 return 0; 131 return 0;
123 } 132 }
124 133
125 void Frame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow) 134 void Frame::setDOMWindow(PassRefPtrWillBeRawPtr<LocalDOMWindow> domWindow)
126 { 135 {
127 if (m_domWindow) 136 if (m_domWindow)
128 m_domWindow->reset(); 137 m_domWindow->reset();
138
129 m_domWindow = domWindow; 139 m_domWindow = domWindow;
130 } 140 }
131 141
132 static ChromeClient& emptyChromeClient() 142 static ChromeClient& emptyChromeClient()
133 { 143 {
134 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, ()); 144 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, ());
135 return client; 145 return client;
136 } 146 }
137 147
138 ChromeClient& Frame::chromeClient() const 148 ChromeClient& Frame::chromeClient() const
(...skipping 12 matching lines...) Expand all
151 return 0; 161 return 0;
152 // FIXME: If <object> is ever fixed to disassociate itself from frames 162 // 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 163 // that it has started but canceled, then this can turn into an ASSERT
154 // since ownerElement() would be 0 when the load is canceled. 164 // since ownerElement() would be 0 when the load is canceled.
155 // https://bugs.webkit.org/show_bug.cgi?id=18585 165 // https://bugs.webkit.org/show_bug.cgi?id=18585
156 if (!object->isRenderPart()) 166 if (!object->isRenderPart())
157 return 0; 167 return 0;
158 return toRenderPart(object); 168 return toRenderPart(object);
159 } 169 }
160 170
161 void Frame::setRemotePlatformLayer(blink::WebLayer* layer) 171 void Frame::setRemotePlatformLayer(WebLayer* layer)
162 { 172 {
163 if (m_remotePlatformLayer) 173 if (m_remotePlatformLayer)
164 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer); 174 GraphicsLayer::unregisterContentsLayer(m_remotePlatformLayer);
165 m_remotePlatformLayer = layer; 175 m_remotePlatformLayer = layer;
166 if (m_remotePlatformLayer) 176 if (m_remotePlatformLayer)
167 GraphicsLayer::registerContentsLayer(layer); 177 GraphicsLayer::registerContentsLayer(layer);
168 178
169 ASSERT(owner()); 179 ASSERT(owner());
170 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate(); 180 toHTMLFrameOwnerElement(owner())->setNeedsCompositingUpdate();
171 if (RenderPart* renderer = ownerRenderer()) 181 if (RenderPart* renderer = ownerRenderer())
(...skipping 18 matching lines...) Expand all
190 } 200 }
191 201
192 void Frame::disconnectOwnerElement() 202 void Frame::disconnectOwnerElement()
193 { 203 {
194 if (m_owner) { 204 if (m_owner) {
195 if (m_owner->isLocal()) 205 if (m_owner->isLocal())
196 toHTMLFrameOwnerElement(m_owner)->clearContentFrame(); 206 toHTMLFrameOwnerElement(m_owner)->clearContentFrame();
197 if (page()) 207 if (page())
198 page()->decrementSubframeCount(); 208 page()->decrementSubframeCount();
199 } 209 }
200 m_owner = 0; 210 m_owner = nullptr;
201 } 211 }
202 212
203 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const 213 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const
204 { 214 {
205 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0; 215 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) : 0;
206 } 216 }
207 217
208 } // namespace blink 218 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698