Bug 145593

Summary: Make CSSStyleDeclaration to reference countable
Product: WebKit Reporter: Hyungwook Lee <hyungwook.lee>
Component: CSSAssignee: Gyuyoung Kim <gyuyoung.kim>
Status: RESOLVED INVALID    
Severity: Normal CC: darin, gyuyoung.kim, kling, koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch koivisto: review-

Hyungwook Lee
Reported 2015-06-02 22:23:45 PDT
CSSStyleDeclaration class and its child classes have handled reference count manually. I think it would be good if we delegate the reference count to RefCount framework.
Attachments
Patch (7.66 KB, patch)
2015-06-02 22:24 PDT, Gyuyoung Kim
koivisto: review-
Gyuyoung Kim
Comment 1 2015-06-02 22:24:39 PDT
Darin Adler
Comment 2 2015-06-03 13:37:07 PDT
Comment on attachment 254148 [details] Patch Andreas or Antti did this intentionally, perhaps to save memory. One of them needs to review this.
Antti Koivisto
Comment 3 2015-06-05 06:41:47 PDT
Comment on attachment 254148 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254148&action=review > Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:-129 > -void PropertySetCSSStyleDeclaration::ref() > -{ > - m_propertySet->ref(); > -} > - > -void PropertySetCSSStyleDeclaration::deref() > -{ > - m_propertySet->deref(); > -} These types have custom refcounting so we can do this here. Basically the refcount of PropertySetCSSStyleDeclaration is delegated to the underlying property set. This scheme is used so CSSStyleDeclaration wrappers for property sets keep their script-observable identity. > Source/WebCore/css/PropertySetCSSStyleDeclaration.h:76 > - MutableStyleProperties* m_propertySet; > + RefPtr<MutableStyleProperties> m_propertySet; This creates an ownership cycle. MutableStyleProperties has std::unique_ptr<PropertySetCSSStyleDeclaration> m_cssomWrapper; This will prevent it from dying and we'll leak MutableStyleProperties/PropertySetCSSStyleDeclaration pairs.
Gyuyoung Kim
Comment 4 2015-06-10 17:48:36 PDT
(In reply to comment #3) > Comment on attachment 254148 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=254148&action=review > > > Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:-129 > > -void PropertySetCSSStyleDeclaration::ref() > > -{ > > - m_propertySet->ref(); > > -} > > - > > -void PropertySetCSSStyleDeclaration::deref() > > -{ > > - m_propertySet->deref(); > > -} > > These types have custom refcounting so we can do this here. Basically the > refcount of PropertySetCSSStyleDeclaration is delegated to the underlying > property set. This scheme is used so CSSStyleDeclaration wrappers for > property sets keep their script-observable identity. > > > Source/WebCore/css/PropertySetCSSStyleDeclaration.h:76 > > - MutableStyleProperties* m_propertySet; > > + RefPtr<MutableStyleProperties> m_propertySet; > > This creates an ownership cycle. MutableStyleProperties has > > std::unique_ptr<PropertySetCSSStyleDeclaration> m_cssomWrapper; > > This will prevent it from dying and we'll leak > MutableStyleProperties/PropertySetCSSStyleDeclaration pairs. Thank you for your review !
Note You need to log in before you can comment on or make changes to this bug.