Bug 152902 - Use NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL
Summary: Use NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords: Performance
Depends on: 153020
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-08 10:55 PST by Andreas Kling
Modified: 2016-01-13 15:02 PST (History)
4 users (show)

See Also:


Attachments
Patch (255.04 KB, patch)
2016-01-08 11:12 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (255.68 KB, patch)
2016-01-08 11:43 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (256.32 KB, patch)
2016-01-08 11:57 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (257.08 KB, patch)
2016-01-08 12:34 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (258.61 KB, patch)
2016-01-08 12:49 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (259.25 KB, patch)
2016-01-08 13:23 PST, Andreas Kling
andersca: review+
Details | Formatted Diff | Diff
Patch (259.48 KB, patch)
2016-01-08 13:50 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (260.59 KB, patch)
2016-01-08 20:45 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch 2 (convert some more code) (20.23 KB, patch)
2016-01-09 15:03 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch 2 (convert some more code) (21.00 KB, patch)
2016-01-09 17:18 PST, Andreas Kling
aestes: review+
Details | Formatted Diff | Diff
Patch 2 for landing (20.67 KB, patch)
2016-01-10 04:38 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2016-01-08 10:55:14 PST
We should use NeverDestroyed everywhere instead of DEPRECATED_DEFINE_STATIC_LOCAL, to ameliorate heap fragmentation from lazily instantiated statics.
Comment 1 Chris Dumez 2016-01-08 10:55:52 PST
Yes please
Comment 2 Andreas Kling 2016-01-08 11:12:01 PST
Created attachment 268554 [details]
Patch

Almost all done with regex, let's see what EWS thinks..
Comment 3 WebKit Commit Bot 2016-01-08 11:13:25 PST
Attachment 268554 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/network/HTTPParsers.cpp:39:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/platform/audio/ios/AudioDestinationIOS.cpp:44:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/page/ContentSecurityPolicy.cpp:49:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/platform/graphics/GraphicsLayer.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/rendering/style/RenderStyle.h:72:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 5 in 174 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Andreas Kling 2016-01-08 11:43:23 PST
Created attachment 268563 [details]
Patch
Comment 5 Andreas Kling 2016-01-08 11:57:37 PST
Created attachment 268567 [details]
Patch
Comment 6 Andreas Kling 2016-01-08 12:34:44 PST
Created attachment 268570 [details]
Patch
Comment 7 Andreas Kling 2016-01-08 12:49:31 PST
Created attachment 268573 [details]
Patch
Comment 8 Andreas Kling 2016-01-08 13:23:55 PST
Created attachment 268576 [details]
Patch
Comment 9 Andreas Kling 2016-01-08 13:50:11 PST
Created attachment 268581 [details]
Patch
Comment 10 Andreas Kling 2016-01-08 20:45:51 PST
Created attachment 268608 [details]
Patch
Comment 11 WebKit Commit Bot 2016-01-09 05:14:00 PST
Comment on attachment 268608 [details]
Patch

Clearing flags on attachment: 268608

Committed r194819: <http://trac.webkit.org/changeset/194819>
Comment 12 WebKit Commit Bot 2016-01-09 05:14:05 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Andreas Kling 2016-01-09 15:03:24 PST
Reopening to attach more patch.
Comment 14 Andreas Kling 2016-01-09 15:03:54 PST
Created attachment 268628 [details]
Patch 2 (convert some more code)
Comment 15 WebKit Commit Bot 2016-01-09 15:05:06 PST
Attachment 268628 [details] did not pass style-queue:


ERROR: Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h:98:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm:68:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 16 Andreas Kling 2016-01-09 17:18:55 PST
Created attachment 268634 [details]
Patch 2 (convert some more code)
Comment 17 WebKit Commit Bot 2016-01-09 17:21:07 PST
Attachment 268634 [details] did not pass style-queue:


ERROR: Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h:33:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h:98:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 2 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 18 Andy Estes 2016-01-09 17:46:41 PST
Comment on attachment 268634 [details]
Patch 2 (convert some more code)

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

> Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h:92
> +    static NeverDestroyed<const SVGPropertyInfo> s_propertyInfo = SVGPropertyInfo \

Why the " = SVGPropertyInfo"?

> Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm:71
> -    DEPRECATED_DEFINE_STATIC_LOCAL(RetainPtr<NSArray>, types, ([[NSArray alloc] initWithObjects:
> +    static NeverDestroyed<RetainPtr<NSArray>> types([[NSArray alloc] initWithObjects:
>          WebURLsWithTitlesPboardType,
>          NSURLPboardType,
>          WebURLPboardType,
>          WebURLNamePboardType,
>          NSStringPboardType,
> -        nil]));
> -    return types.get();
> +        nil]);
> +    return types.get().get();

Even better here would be a plain old static NSArray * storing a leaked value.

> Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm:84
> -    DEPRECATED_DEFINE_STATIC_LOCAL(RetainPtr<NSArray>, types, (_createWritableTypesForImageWithoutArchive()));
> -    return types.get();
> +    static NeverDestroyed<RetainPtr<NSArray>> types(_createWritableTypesForImageWithoutArchive());
> +    return types.get().get();

Ditto.

> Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm:98
> -    DEPRECATED_DEFINE_STATIC_LOCAL(RetainPtr<NSArray>, types, (_createWritableTypesForImageWithArchive()));
> -    return types.get();
> +    static NeverDestroyed<RetainPtr<NSArray>> types(_createWritableTypesForImageWithArchive());
> +    return types.get().get();

Ditto.
Comment 19 Andreas Kling 2016-01-10 04:38:52 PST
Created attachment 268644 [details]
Patch 2 for landing
Comment 20 WebKit Commit Bot 2016-01-10 04:41:38 PST
Attachment 268644 [details] did not pass style-queue:


ERROR: Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.h:33:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/svg/properties/SVGAnimatedPropertyMacros.h:98:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 2 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 21 WebKit Commit Bot 2016-01-10 05:27:58 PST
Comment on attachment 268644 [details]
Patch 2 for landing

Clearing flags on attachment: 268644

Committed r194826: <http://trac.webkit.org/changeset/194826>
Comment 22 WebKit Commit Bot 2016-01-10 05:28:03 PST
All reviewed patches have been landed.  Closing bug.
Comment 23 Chris Dumez 2016-01-12 09:27:05 PST
Looks like this was a decent PLT regression:
<rdar://problem/24150482>
Comment 24 WebKit Commit Bot 2016-01-12 10:10:48 PST
Re-opened since this is blocked by bug 153020
Comment 25 Chris Dumez 2016-01-13 15:02:00 PST
Rolled back in: https://trac.webkit.org/r194987.