Changeset 206661 in webkit
- Timestamp:
- Sep 30, 2016 1:52:02 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206659 r206661 1 2016-09-30 Zalan Bujtas <zalan@apple.com> 2 3 Remove ClipRects's custom refcounting. 4 https://bugs.webkit.org/show_bug.cgi?id=162798 5 6 Reviewed by Simon Fraser. 7 8 It's safer to use RefCounted<>. 9 10 No change in functionality. 11 12 * rendering/RenderLayer.cpp: 13 (WebCore::ClipRects::ClipRects): 14 (WebCore::ClipRectsCache::getClipRects): 15 (WebCore::ClipRectsCache::setClipRects): 16 (WebCore::ClipRectsCache::getIndex): 17 (WebCore::RenderLayer::updateClipRects): 18 (WebCore::ClipRects::ref): Deleted. 19 (WebCore::ClipRects::deref): Deleted. 20 1 21 2016-09-30 Chris Dumez <cdumez@apple.com> 2 22 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r206639 r206661 138 138 using namespace HTMLNames; 139 139 140 class ClipRects {140 class ClipRects : public RefCounted<ClipRects> { 141 141 WTF_MAKE_FAST_ALLOCATED; 142 142 public: … … 150 150 return adoptRef(*new ClipRects(other)); 151 151 } 152 153 ClipRects() = default;154 152 155 153 void reset() … … 172 170 bool fixed() const { return m_fixed; } 173 171 void setFixed(bool fixed) { m_fixed = fixed; } 174 175 void ref() { m_refCount++; }176 void deref()177 {178 if (!--m_refCount)179 delete this;180 }181 172 182 173 bool operator==(const ClipRects& other) const … … 198 189 199 190 private: 191 ClipRects() = default; 192 200 193 ClipRects(const LayoutRect& clipRect) 201 194 : m_overflowClipRect(clipRect) … … 206 199 207 200 ClipRects(const ClipRects& other) 208 : m_overflowClipRect(other.overflowClipRect()) 201 : m_fixed(other.fixed()) 202 , m_overflowClipRect(other.overflowClipRect()) 209 203 , m_fixedClipRect(other.fixedClipRect()) 210 204 , m_posClipRect(other.posClipRect()) 211 , m_fixed(other.fixed())212 205 { 213 206 } 214 207 208 bool m_fixed { false }; 215 209 ClipRect m_overflowClipRect; 216 210 ClipRect m_fixedClipRect; 217 211 ClipRect m_posClipRect; 218 unsigned m_refCount = 1;219 bool m_fixed = false;220 212 }; 221 213 … … 233 225 } 234 226 235 ClipRects* getClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow) { return m_clipRects[getIndex(clipRectsType, respectOverflow)].get(); } 236 void setClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow, RefPtr<ClipRects>&& clipRects) { m_clipRects[getIndex(clipRectsType, respectOverflow)] = WTFMove(clipRects); } 227 ClipRects* getClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow) const 228 { 229 return m_clipRects[getIndex(clipRectsType, respectOverflow)].get(); 230 } 231 232 void setClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow, RefPtr<ClipRects>&& clipRects) 233 { 234 m_clipRects[getIndex(clipRectsType, respectOverflow)] = WTFMove(clipRects); 235 } 237 236 238 237 #ifndef NDEBUG … … 242 241 243 242 private: 244 int getIndex(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow)243 unsigned getIndex(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow) const 245 244 { 246 int index = static_cast<int>(clipRectsType);245 unsigned index = static_cast<unsigned>(clipRectsType); 247 246 if (respectOverflow == RespectOverflowClip) 248 index += static_cast<int>(NumCachedClipRectsTypes); 247 index += static_cast<unsigned>(NumCachedClipRectsTypes); 248 ASSERT_WITH_SECURITY_IMPLICATION(index < NumCachedClipRectsTypes * 2); 249 249 return index; 250 250 } … … 5419 5419 ClipRectsContext tempContext(clipRectsContext); 5420 5420 tempContext.clipRectsType = TemporaryClipRects; 5421 ClipRects tempClipRects;5421 Ref<ClipRects> tempClipRects = ClipRects::create(); 5422 5422 calculateClipRects(tempContext, tempClipRects); 5423 ASSERT(tempClipRects == *clipRects);5423 ASSERT(tempClipRects.get() == *clipRects); 5424 5424 #endif 5425 5425 return *clipRects; // We have the correct cached value.
Note: See TracChangeset
for help on using the changeset viewer.