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

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp

Issue 1580503003: Eliminate superfluous clearing of weak pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Eliminate superfluous WeakPtrFactory::clear() Created 4 years, 11 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/IntersectionObservation.h" 5 #include "core/dom/IntersectionObservation.h"
6 6
7 #include "core/dom/ElementRareData.h" 7 #include "core/dom/ElementRareData.h"
8 #include "core/dom/IntersectionObserver.h" 8 #include "core/dom/IntersectionObserver.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/layout/LayoutBox.h" 10 #include "core/layout/LayoutBox.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (geometry.intersectionRect.size().isZero()) 109 if (geometry.intersectionRect.size().isZero())
110 geometry.intersectionRect = LayoutRect(); 110 geometry.intersectionRect = LayoutRect();
111 if (!m_shouldReportRootBounds) 111 if (!m_shouldReportRootBounds)
112 geometry.rootRect = LayoutRect(); 112 geometry.rootRect = LayoutRect();
113 113
114 return true; 114 return true;
115 } 115 }
116 116
117 void IntersectionObservation::computeIntersectionObservations(double timestamp) 117 void IntersectionObservation::computeIntersectionObservations(double timestamp)
118 { 118 {
119 // Pre-oilpan, there will be a delay between the time when the target Elemen t gets deleted
120 // (because its ref count dropped to zero) and when this IntersectionObserva tion gets
121 // deleted (during the next gc run, because the target Element is the only t hing keeping
122 // the IntersectionObservation alive). During that interval, we need to che ck that m_target
123 // hasn't been cleared.
119 Element* targetElement = target(); 124 Element* targetElement = target();
120 if (!targetElement || !isActive()) 125 if (!targetElement || !isActive())
121 return; 126 return;
122 LayoutObject* targetLayoutObject = targetElement->layoutObject(); 127 LayoutObject* targetLayoutObject = targetElement->layoutObject();
123 // TODO(szager): Support SVG 128 // TODO(szager): Support SVG
124 if (!targetLayoutObject || (!targetLayoutObject->isBox() && !targetLayoutObj ect->isInline())) 129 if (!targetLayoutObject || (!targetLayoutObject->isBox() && !targetLayoutObj ect->isInline()))
125 return; 130 return;
126 131
127 IntersectionGeometry geometry; 132 IntersectionGeometry geometry;
128 if (!computeGeometry(geometry)) 133 if (!computeGeometry(geometry))
(...skipping 25 matching lines...) Expand all
154 m_observer.clear(); 159 m_observer.clear();
155 } 160 }
156 161
157 DEFINE_TRACE(IntersectionObservation) 162 DEFINE_TRACE(IntersectionObservation)
158 { 163 {
159 visitor->trace(m_observer); 164 visitor->trace(m_observer);
160 visitor->trace(m_target); 165 visitor->trace(m_target);
161 } 166 }
162 167
163 } // namespace blink 168 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698