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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp

Issue 2258033002: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. Created 4 years, 4 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) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 WidgetSet set; 105 WidgetSet set;
106 widgetsPendingDispose().swap(set); 106 widgetsPendingDispose().swap(set);
107 for (const auto& widget : set) { 107 for (const auto& widget : set) {
108 widget->dispose(); 108 widget->dispose();
109 } 109 }
110 } 110 }
111 } 111 }
112 112
113 HTMLFrameOwnerElement::UpdateSuspendScope::~UpdateSuspendScope() 113 HTMLFrameOwnerElement::UpdateSuspendScope::~UpdateSuspendScope()
114 { 114 {
115 ASSERT(s_updateSuspendCount > 0); 115 DCHECK_GT(s_updateSuspendCount, 0u);
116 if (s_updateSuspendCount == 1) 116 if (s_updateSuspendCount == 1)
117 performDeferredWidgetTreeOperations(); 117 performDeferredWidgetTreeOperations();
118 --s_updateSuspendCount; 118 --s_updateSuspendCount;
119 } 119 }
120 120
121 // Unlike moveWidgetToParentSoon, this will not call dispose the Widget. 121 // Unlike moveWidgetToParentSoon, this will not call dispose the Widget.
122 void temporarilyRemoveWidgetFromParentSoon(Widget* widget) 122 void temporarilyRemoveWidgetFromParentSoon(Widget* widget)
123 { 123 {
124 if (s_updateSuspendCount) { 124 if (s_updateSuspendCount) {
125 widgetsPendingTemporaryRemovalFromParent().add(widget); 125 widgetsPendingTemporaryRemovalFromParent().add(widget);
(...skipping 30 matching lines...) Expand all
156 // HTMLObjectElement and HTMLEmbedElement may return arbitrary layoutObjects 156 // HTMLObjectElement and HTMLEmbedElement may return arbitrary layoutObjects
157 // when using fallback content. 157 // when using fallback content.
158 if (!layoutObject() || !layoutObject()->isLayoutPart()) 158 if (!layoutObject() || !layoutObject()->isLayoutPart())
159 return nullptr; 159 return nullptr;
160 return toLayoutPart(layoutObject()); 160 return toLayoutPart(layoutObject());
161 } 161 }
162 162
163 void HTMLFrameOwnerElement::setContentFrame(Frame& frame) 163 void HTMLFrameOwnerElement::setContentFrame(Frame& frame)
164 { 164 {
165 // Make sure we will not end up with two frames referencing the same owner e lement. 165 // Make sure we will not end up with two frames referencing the same owner e lement.
166 ASSERT(!m_contentFrame || m_contentFrame->owner() != this); 166 DCHECK(!m_contentFrame || m_contentFrame->owner() != this);
167 // Disconnected frames should not be allowed to load. 167 // Disconnected frames should not be allowed to load.
168 ASSERT(isConnected()); 168 DCHECK(isConnected());
169 m_contentFrame = &frame; 169 m_contentFrame = &frame;
170 170
171 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode() ) 171 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode() )
172 node->incrementConnectedSubframeCount(); 172 node->incrementConnectedSubframeCount();
173 } 173 }
174 174
175 void HTMLFrameOwnerElement::clearContentFrame() 175 void HTMLFrameOwnerElement::clearContentFrame()
176 { 176 {
177 if (!m_contentFrame) 177 if (!m_contentFrame)
178 return; 178 return;
179 179
180 ASSERT(m_contentFrame->owner() == this); 180 DCHECK_EQ(m_contentFrame->owner(), this);
181 m_contentFrame = nullptr; 181 m_contentFrame = nullptr;
182 182
183 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode() ) 183 for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode() )
184 node->decrementConnectedSubframeCount(); 184 node->decrementConnectedSubframeCount();
185 } 185 }
186 186
187 void HTMLFrameOwnerElement::disconnectContentFrame() 187 void HTMLFrameOwnerElement::disconnectContentFrame()
188 { 188 {
189 // FIXME: Currently we don't do this in removedFrom because this causes an 189 // FIXME: Currently we don't do this in removedFrom because this causes an
190 // unload event in the subframe which could execute script that could then 190 // unload event in the subframe which could execute script that could then
191 // reach up into this document and then attempt to look back down. We should 191 // reach up into this document and then attempt to look back down. We should
192 // see if this behavior is really needed as Gecko does not allow this. 192 // see if this behavior is really needed as Gecko does not allow this.
193 if (Frame* frame = contentFrame()) { 193 if (Frame* frame = contentFrame()) {
194 frame->detach(FrameDetachType::Remove); 194 frame->detach(FrameDetachType::Remove);
195 } 195 }
196 } 196 }
197 197
198 HTMLFrameOwnerElement::~HTMLFrameOwnerElement() 198 HTMLFrameOwnerElement::~HTMLFrameOwnerElement()
199 { 199 {
200 // An owner must by now have been informed of detachment 200 // An owner must by now have been informed of detachment
201 // when the frame was closed. 201 // when the frame was closed.
202 ASSERT(!m_contentFrame); 202 DCHECK(!m_contentFrame);
203 } 203 }
204 204
205 Document* HTMLFrameOwnerElement::contentDocument() const 205 Document* HTMLFrameOwnerElement::contentDocument() const
206 { 206 {
207 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c ontentFrame)->document() : 0; 207 return (m_contentFrame && m_contentFrame->isLocalFrame()) ? toLocalFrame(m_c ontentFrame)->document() : 0;
208 } 208 }
209 209
210 DOMWindow* HTMLFrameOwnerElement::contentWindow() const 210 DOMWindow* HTMLFrameOwnerElement::contentWindow() const
211 { 211 {
212 return m_contentFrame ? m_contentFrame->domWindow() : 0; 212 return m_contentFrame ? m_contentFrame->domWindow() : 0;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 m_widget = widget; 268 m_widget = widget;
269 269
270 LayoutPart* layoutPart = toLayoutPart(layoutObject()); 270 LayoutPart* layoutPart = toLayoutPart(layoutObject());
271 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart); 271 LayoutPartItem layoutPartItem = LayoutPartItem(layoutPart);
272 if (layoutPartItem.isNull()) 272 if (layoutPartItem.isNull())
273 return; 273 return;
274 274
275 if (m_widget) { 275 if (m_widget) {
276 layoutPartItem.updateOnWidgetChange(); 276 layoutPartItem.updateOnWidgetChange();
277 277
278 ASSERT(document().view() == layoutPartItem.frameView()); 278 DCHECK_EQ(document().view(), layoutPartItem.frameView());
279 ASSERT(layoutPartItem.frameView()); 279 DCHECK(layoutPartItem.frameView());
280 moveWidgetToParentSoon(m_widget.get(), layoutPartItem.frameView()); 280 moveWidgetToParentSoon(m_widget.get(), layoutPartItem.frameView());
281 } 281 }
282 282
283 if (AXObjectCache* cache = document().existingAXObjectCache()) 283 if (AXObjectCache* cache = document().existingAXObjectCache())
284 cache->childrenChanged(layoutPart); 284 cache->childrenChanged(layoutPart);
285 } 285 }
286 286
287 Widget* HTMLFrameOwnerElement::releaseWidget() 287 Widget* HTMLFrameOwnerElement::releaseWidget()
288 { 288 {
289 if (!m_widget) 289 if (!m_widget)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 DEFINE_TRACE(HTMLFrameOwnerElement) 334 DEFINE_TRACE(HTMLFrameOwnerElement)
335 { 335 {
336 visitor->trace(m_contentFrame); 336 visitor->trace(m_contentFrame);
337 visitor->trace(m_widget); 337 visitor->trace(m_widget);
338 HTMLElement::trace(visitor); 338 HTMLElement::trace(visitor);
339 FrameOwner::trace(visitor); 339 FrameOwner::trace(visitor);
340 } 340 }
341 341
342 342
343 } // namespace blink 343 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698