Bug 119769 - Stop using DEFINE_STATIC_LOCAL with RefPtr
Summary: Stop using DEFINE_STATIC_LOCAL with RefPtr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-13 14:25 PDT by Anders Carlsson
Modified: 2013-08-13 14:46 PDT (History)
0 users

See Also:


Attachments
Patch (13.79 KB, patch)
2013-08-13 14:26 PDT, Anders Carlsson
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2013-08-13 14:25:43 PDT
Stop using DEFINE_STATIC_LOCAL with RefPtr
Comment 1 Anders Carlsson 2013-08-13 14:26:44 PDT
Created attachment 208677 [details]
Patch
Comment 2 Andreas Kling 2013-08-13 14:35:03 PDT
Comment on attachment 208677 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=208677&action=review

r=me, but...

It'd be nice to make the methods that never return null return references instead of pointers.

> Source/WebCore/editing/EditingStyle.cpp:1431
> -        DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, underline, (CSSPrimitiveValue::createIdentifier(CSSValueUnderline)));
> -        DEFINE_STATIC_LOCAL(RefPtr<CSSPrimitiveValue>, lineThrough, (CSSPrimitiveValue::createIdentifier(CSSValueLineThrough)));
> +        static CSSPrimitiveValue* underline = CSSPrimitiveValue::createIdentifier(CSSValueUnderline).leakRef();
> +        static CSSPrimitiveValue* lineThrough = CSSPrimitiveValue::createIdentifier(CSSValueLineThrough).leakRef();

This is silly, we should just use cssValuePool().createIdentifierValue(CSSValueUnderline / CSSValueLineThrough) for these instead. Save even more memory :)
Comment 3 Anders Carlsson 2013-08-13 14:46:52 PDT
Committed r154023: <http://trac.webkit.org/changeset/154023>