Changeset 230737 in webkit
- Timestamp:
- Apr 17, 2018 4:33:02 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r230736 r230737 1 2018-04-17 Tadeu Zagallo <tzagallo@apple.com> 2 3 References from CSSStyleDeclaration to CSSValues should be weak 4 https://bugs.webkit.org/show_bug.cgi?id=180280 5 <rdar://problem/35804869> 6 7 Reviewed by Geoffrey Garen. 8 9 No new tests - used the existing test to verify the leak 10 11 * css/DeprecatedCSSOMValue.h: 12 (WebCore::DeprecatedCSSOMValue::weakPtrFactory): 13 * css/PropertySetCSSStyleDeclaration.cpp: 14 (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM): 15 * css/PropertySetCSSStyleDeclaration.h: 16 1 17 2018-04-17 Jonathan Bedard <jbedard@apple.com> 2 18 -
trunk/Source/WebCore/css/DeprecatedCSSOMValue.h
r226382 r230737 32 32 #include <wtf/RefCounted.h> 33 33 #include <wtf/TypeCasts.h> 34 #include <wtf/WeakPtr.h> 34 35 #include <wtf/text/WTFString.h> 35 36 … … 65 66 CSSStyleDeclaration& owner() const { return m_owner; } 66 67 68 WeakPtrFactory<DeprecatedCSSOMValue>& weakPtrFactory() { return m_weakPtrFactory; } 69 67 70 protected: 68 71 static const size_t ClassTypeBits = 2; … … 93 96 94 97 Ref<CSSStyleDeclaration> m_owner; 98 WeakPtrFactory<DeprecatedCSSOMValue> m_weakPtrFactory; 95 99 }; 96 100 -
trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
r219856 r230737 309 309 } 310 310 311 DeprecatedCSSOMValue*PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM(CSSValue* internalValue)311 RefPtr<DeprecatedCSSOMValue> PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM(CSSValue* internalValue) 312 312 { 313 313 if (!internalValue) … … 317 317 // FIXME: It is likely that the identity is not important for web compatibility and this code should be removed. 318 318 if (!m_cssomValueWrappers) 319 m_cssomValueWrappers = std::make_unique<HashMap<CSSValue*, RefPtr<DeprecatedCSSOMValue>>>();319 m_cssomValueWrappers = std::make_unique<HashMap<CSSValue*, WeakPtr<DeprecatedCSSOMValue>>>(); 320 320 321 RefPtr<DeprecatedCSSOMValue>& clonedValue = m_cssomValueWrappers->add(internalValue, RefPtr<DeprecatedCSSOMValue>()).iterator->value; 322 if (!clonedValue) 323 clonedValue = internalValue->createDeprecatedCSSOMWrapper(*this); 324 return clonedValue.get(); 321 auto& clonedValue = m_cssomValueWrappers->add(internalValue, WeakPtr<DeprecatedCSSOMValue>()).iterator->value; 322 if (clonedValue) 323 return clonedValue.get(); 324 325 RefPtr<DeprecatedCSSOMValue> wrapper = internalValue->createDeprecatedCSSOMWrapper(*this); 326 clonedValue = makeWeakPtr(wrapper.get()); 327 return wrapper; 325 328 } 326 329 -
trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.h
r219744 r230737 32 32 #include <wtf/HashMap.h> 33 33 #include <wtf/RefPtr.h> 34 #include <wtf/WeakPtr.h> 34 35 35 36 namespace WebCore { … … 58 59 59 60 MutableStyleProperties* m_propertySet; 60 std::unique_ptr<HashMap<CSSValue*, RefPtr<DeprecatedCSSOMValue>>> m_cssomValueWrappers;61 std::unique_ptr<HashMap<CSSValue*, WeakPtr<DeprecatedCSSOMValue>>> m_cssomValueWrappers; 61 62 62 63 private: … … 82 83 Ref<MutableStyleProperties> copyProperties() const final; 83 84 84 DeprecatedCSSOMValue*wrapForDeprecatedCSSOM(CSSValue*);85 RefPtr<DeprecatedCSSOMValue> wrapForDeprecatedCSSOM(CSSValue*); 85 86 86 87 virtual bool willMutate() WARN_UNUSED_RETURN { return true; }
Note: See TracChangeset
for help on using the changeset viewer.