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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2858963002: Replace ASSERT with DCHECK in core/ (Closed)
Patch Set: WorkerBackingThread Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 883b2e6094c2c98dfe4a118219d84c399808bb79..ae3818d3c8d36c02f6bc7066a16ebf685155cf5d 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -232,7 +232,9 @@ FrameView* FrameView::Create(LocalFrame& frame, const IntSize& initial_size) {
}
FrameView::~FrameView() {
- ASSERT(has_been_disposed_);
+#if DCHECK_IS_ON()
+ DCHECK(has_been_disposed_);
+#endif
}
DEFINE_TRACE(FrameView) {
@@ -990,7 +992,7 @@ inline void FrameView::ForceLayoutParentViewIfNeeded() {
// Synchronously enter layout, to layout the view containing the host
// object/embed/iframe.
- ASSERT(frame_view);
+ DCHECK(frame_view);
frame_view->UpdateLayout();
}
@@ -1108,7 +1110,7 @@ void FrameView::PerformLayout(bool in_subtree_layout) {
ScheduleOrthogonalWritingModeRootsForLayout();
}
- ASSERT(!IsInPerformLayout());
+ DCHECK(!IsInPerformLayout());
Lifecycle().AdvanceTo(DocumentLifecycle::kInPerformLayout);
// performLayout is the actual guts of layout().
@@ -1179,9 +1181,9 @@ void FrameView::ScheduleOrPerformPostLayoutTasks() {
void FrameView::UpdateLayout() {
// We should never layout a Document which is not in a LocalFrame.
- ASSERT(frame_);
+ DCHECK(frame_);
ASSERT(frame_->View() == this);
- ASSERT(frame_->GetPage());
+ DCHECK(frame_->GetPage());
ScriptForbiddenScope forbid_script;
@@ -1313,7 +1315,7 @@ void FrameView::UpdateLayout() {
if (!in_subtree_layout && !document->Printing())
AdjustViewSizeAndLayout();
- ASSERT(layout_subtree_root_list_.IsEmpty());
+ DCHECK(layout_subtree_root_list_.IsEmpty());
} // Reset m_layoutSchedulingEnabled to its previous value.
CheckDoesNotNeedLayout();
@@ -1373,7 +1375,7 @@ void FrameView::DeprecatedInvalidateTree(
RELEASE_ASSERT(!GetLayoutViewItem().IsNull());
LayoutViewItem root_for_paint_invalidation = GetLayoutViewItem();
- ASSERT(!root_for_paint_invalidation.NeedsLayout());
+ DCHECK(!root_for_paint_invalidation.NeedsLayout());
TRACE_EVENT1("blink", "FrameView::invalidateTree", "root",
root_for_paint_invalidation.DebugName().Ascii());
@@ -1524,10 +1526,10 @@ void FrameView::UpdateGeometries() {
}
void FrameView::AddPartToUpdate(LayoutEmbeddedObject& object) {
- ASSERT(IsInPerformLayout());
+ DCHECK(IsInPerformLayout());
// Tell the DOM element that it needs a FrameViewBase update.
Node* node = object.GetNode();
- ASSERT(node);
+ DCHECK(node);
if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node))
ToHTMLPlugInElement(node)->SetNeedsPluginUpdate(true);
@@ -1591,7 +1593,7 @@ bool FrameView::ContentsInCompositedLayer() const {
}
void FrameView::AddBackgroundAttachmentFixedObject(LayoutObject* object) {
- ASSERT(!background_attachment_fixed_objects_.Contains(object));
+ DCHECK(!background_attachment_fixed_objects_.Contains(object));
background_attachment_fixed_objects_.insert(object);
if (ScrollingCoordinator* scrolling_coordinator =
@@ -1608,7 +1610,7 @@ void FrameView::AddBackgroundAttachmentFixedObject(LayoutObject* object) {
}
void FrameView::RemoveBackgroundAttachmentFixedObject(LayoutObject* object) {
- ASSERT(background_attachment_fixed_objects_.Contains(object));
+ DCHECK(background_attachment_fixed_objects_.Contains(object));
background_attachment_fixed_objects_.erase(object);
if (ScrollingCoordinator* scrolling_coordinator =
@@ -1783,8 +1785,8 @@ bool FrameView::InvalidateViewportConstrainedObjects() {
*viewport_constrained_objects_) {
LayoutObject* layout_object = viewport_constrained_object;
LayoutItem layout_item = LayoutItem(layout_object);
- ASSERT(layout_item.Style()->HasViewportConstrainedPosition());
- ASSERT(layout_item.HasLayer());
+ DCHECK(layout_item.Style()->HasViewportConstrainedPosition());
+ DCHECK(layout_item.HasLayer());
PaintLayer* layer = LayoutBoxModel(layout_item).Layer();
if (layer->IsPaintInvalidationContainer())
@@ -1837,7 +1839,7 @@ void FrameView::ScrollContentsSlowPath() {
// all of the objects.
// FIXME: Find out what are enough to invalidate in slow path scrolling.
// crbug.com/451090#9.
- ASSERT(!GetLayoutViewItem().IsNull());
+ DCHECK(!GetLayoutViewItem().IsNull());
if (ContentsInCompositedLayer())
GetLayoutViewItem()
.Layer()
@@ -1849,7 +1851,7 @@ void FrameView::ScrollContentsSlowPath() {
if (ContentsInCompositedLayer()) {
IntRect update_rect = VisibleContentRect();
- ASSERT(!GetLayoutViewItem().IsNull());
+ DCHECK(!GetLayoutViewItem().IsNull());
// FIXME: We should not allow paint invalidation out of paint invalidation
// state. crbug.com/457415
DisablePaintInvalidationStateAsserts disabler;
@@ -1901,7 +1903,7 @@ void FrameView::ProcessUrlFragment(const KURL& url,
bool FrameView::ProcessUrlFragmentHelper(const String& name,
UrlFragmentBehavior behavior) {
- ASSERT(frame_->GetDocument());
+ DCHECK(frame_->GetDocument());
if (behavior == kUrlFragmentScroll &&
!frame_->GetDocument()->IsRenderingReady()) {
@@ -1954,7 +1956,7 @@ bool FrameView::ProcessUrlFragmentHelper(const String& name,
}
void FrameView::SetFragmentAnchor(Node* anchor_node) {
- ASSERT(anchor_node);
+ DCHECK(anchor_node);
fragment_anchor_ = anchor_node;
// We need to update the layout tree before scrolling.
@@ -2008,7 +2010,7 @@ IntSize FrameView::GetLayoutSize(
}
void FrameView::SetLayoutSize(const IntSize& size) {
- ASSERT(!LayoutSizeFixedToFrameSize());
+ DCHECK(!LayoutSizeFixedToFrameSize());
SetLayoutSizeInternal(size);
}
@@ -2110,7 +2112,7 @@ void FrameView::UpdateCompositedSelectionIfNeeded() {
TRACE_EVENT0("blink", "FrameView::updateCompositedSelectionIfNeeded");
Page* page = GetFrame().GetPage();
- ASSERT(page);
+ DCHECK(page);
CompositedSelection selection;
LocalFrame* focused_frame = page->GetFocusController().FocusedFrame();
@@ -2523,7 +2525,7 @@ bool FrameView::UpdatePlugins() {
}
void FrameView::UpdatePluginsTimerFired(TimerBase*) {
- ASSERT(!IsInPerformLayout());
+ DCHECK(!IsInPerformLayout());
for (unsigned i = 0; i < kMaxUpdatePluginsIterations; ++i) {
if (UpdatePlugins())
return;
@@ -2531,7 +2533,7 @@ void FrameView::UpdatePluginsTimerFired(TimerBase*) {
}
void FrameView::FlushAnyPendingPostLayoutTasks() {
- ASSERT(!IsInPerformLayout());
+ DCHECK(!IsInPerformLayout());
if (post_layout_tasks_timer_.IsActive())
PerformPostLayoutTasks();
if (update_plugins_timer_.IsActive()) {
@@ -2541,7 +2543,7 @@ void FrameView::FlushAnyPendingPostLayoutTasks() {
}
void FrameView::ScheduleUpdatePluginsIfNecessary() {
- ASSERT(!IsInPerformLayout());
+ DCHECK(!IsInPerformLayout());
if (update_plugins_timer_.IsActive() || part_update_set_.IsEmpty())
return;
update_plugins_timer_.StartOneShot(0, BLINK_FROM_HERE);
@@ -2551,18 +2553,18 @@ void FrameView::PerformPostLayoutTasks() {
// FIXME: We can reach here, even when the page is not active!
// http/tests/inspector/elements/html-link-import.html and many other
// tests hit that case.
- // We should ASSERT(isActive()); or at least return early if we can!
+ // We should DCHECK(isActive()); or at least return early if we can!
// Always called before or after performLayout(), part of the highest-level
// layout() call.
- ASSERT(!IsInPerformLayout());
+ DCHECK(!IsInPerformLayout());
TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks");
post_layout_tasks_timer_.Stop();
frame_->Selection().DidLayout();
- ASSERT(frame_->GetDocument());
+ DCHECK(frame_->GetDocument());
FontFaceSet::DidLayout(*frame_->GetDocument());
// Cursor update scheduling is done by the local root, which is the main frame
@@ -2588,17 +2590,17 @@ void FrameView::PerformPostLayoutTasks() {
}
bool FrameView::WasViewportResized() {
- ASSERT(frame_);
+ DCHECK(frame_);
LayoutViewItem layout_view_item = this->GetLayoutViewItem();
if (layout_view_item.IsNull())
return false;
- ASSERT(layout_view_item.Style());
+ DCHECK(layout_view_item.Style());
return (GetLayoutSize(kIncludeScrollbars) != last_viewport_size_ ||
layout_view_item.Style()->Zoom() != last_zoom_factor_);
}
void FrameView::SendResizeEventIfNeeded() {
- ASSERT(frame_);
+ DCHECK(frame_);
LayoutViewItem layout_view_item = this->GetLayoutViewItem();
if (layout_view_item.IsNull() || layout_view_item.GetDocument().Printing())
@@ -3258,7 +3260,7 @@ void FrameView::PaintTree() {
(!GetFrame().Tree().Parent()->IsLocalFrame()));
LayoutViewItem view = GetLayoutViewItem();
- ASSERT(!view.IsNull());
+ DCHECK(!view.IsNull());
ForAllNonThrottledFrameViews([](FrameView& frame_view) {
frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint);
});
@@ -3810,7 +3812,7 @@ void FrameView::RemoveResizerArea(LayoutBox& resizer_box) {
}
void FrameView::AddScrollableArea(ScrollableArea* scrollable_area) {
- ASSERT(scrollable_area);
+ DCHECK(scrollable_area);
if (!scrollable_areas_)
scrollable_areas_ = new ScrollableAreaSet;
scrollable_areas_->insert(scrollable_area);
@@ -3831,7 +3833,7 @@ void FrameView::RemoveScrollableArea(ScrollableArea* scrollable_area) {
}
void FrameView::AddAnimatingScrollableArea(ScrollableArea* scrollable_area) {
- ASSERT(scrollable_area);
+ DCHECK(scrollable_area);
if (!animating_scrollable_areas_)
animating_scrollable_areas_ = new ScrollableAreaSet;
animating_scrollable_areas_->insert(scrollable_area);
@@ -4282,7 +4284,7 @@ void FrameView::UpdateScrollbarGeometry() {
bool FrameView::AdjustScrollbarExistence(
ComputeScrollbarExistenceOption option) {
- ASSERT(in_update_scrollbars_);
+ DCHECK(in_update_scrollbars_);
// If we came in here with the view already needing a layout, then go ahead
// and do that first. (This will be the common case, e.g., when the page
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/FrameViewAutoSizeInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698