Bug 126144 - [WK2] Replace usage of DEFINE_STATIC_LOCAL with NeverDestroyed
Summary: [WK2] Replace usage of DEFINE_STATIC_LOCAL with NeverDestroyed
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: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-22 18:31 PST by Sam Weinig
Modified: 2013-12-23 19:24 PST (History)
1 user (show)

See Also:


Attachments
Patch (56.16 KB, patch)
2013-12-22 18:31 PST, Sam Weinig
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2013-12-22 18:31:10 PST
[WK2] Replace usage of DEFINE_STATIC_LOCAL with NeverDestroyed
Comment 1 Sam Weinig 2013-12-22 18:31:43 PST
Created attachment 219888 [details]
Patch
Comment 2 WebKit Commit Bot 2013-12-22 18:34:31 PST
Attachment 219888 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp', u'Source/WebKit2/DatabaseProcess/DatabaseProcess.h', u'Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp', u'Source/WebKit2/NetworkProcess/NetworkProcess.cpp', u'Source/WebKit2/NetworkProcess/NetworkProcess.h', u'Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp', u'Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm', u'Source/WebKit2/Platform/CoreIPC/Connection.cpp', u'Source/WebKit2/PluginProcess/PluginProcess.cpp', u'Source/WebKit2/PluginProcess/PluginProcess.h', u'Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm', u'Source/WebKit2/Shared/ConnectionStack.cpp', u'Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp', u'Source/WebKit2/Shared/WebContextMenuItem.cpp', u'Source/WebKit2/Shared/WebPreferencesStore.cpp', u'Source/WebKit2/Shared/mac/CookieStorageShim.cpp', u'Source/WebKit2/Shared/mac/CookieStorageShim.h', u'Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp', u'Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h', u'Source/WebKit2/UIProcess/WebContext.cpp', u'Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp', u'Source/WebKit2/UIProcess/WebInspectorProxy.cpp', u'Source/WebKit2/UIProcess/WebPageGroup.cpp', u'Source/WebKit2/UIProcess/WebPageProxy.cpp', u'Source/WebKit2/UIProcess/WebProcessProxy.cpp', u'Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp', u'Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp', u'Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm', u'Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp', u'Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp', u'Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm', u'Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp', u'Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp', u'Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp', u'Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp', u'Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp', u'Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm', u'Source/WebKit2/WebProcess/Storage/StorageNamespaceImpl.cpp', u'Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp', u'Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp', u'Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp', u'Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h', u'Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp', u'Source/WebKit2/WebProcess/WebProcess.cpp', u'Source/WebKit2/WebProcess/WebProcess.h', u'Source/WebKit2/config.h', '--commit-queue']" exit_code: 1
ERROR: Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp:53:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/Shared/mac/CookieStorageShim.h:32:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:93:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/UIProcess/WebContext.cpp:117:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 4 in 46 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Anders Carlsson 2013-12-22 21:25:08 PST
Comment on attachment 219888 [details]
Patch

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

> Source/WebKit2/Shared/WebContextMenuItem.cpp:61
> +    static NeverDestroyed<WebContextMenuItem*> separatorItem(adoptRef(new WebContextMenuItem(WebContextMenuItemData(WebCore::SeparatorType, WebCore::ContextMenuItemTagNoAction, String(), true, false))).leakRef());

This can just be a raw pointer!

> Source/WebKit2/UIProcess/WebContext.cpp:117
> +    static NeverDestroyed<Vector<WebContext*>> contexts;;

Extra semicolon.

> Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp:51
> +    static CFNumberRef version = CFNumberCreate(0, kCFNumberCFIndexType, &currentVersionAsCFIndex);

Nah, this doesn't need to be static.

> Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp:62
> +static CFStringRef SessionHistoryVersionKey = CFSTR("SessionHistoryVersion");
> +static CFStringRef SessionHistoryCurrentIndexKey = CFSTR("SessionHistoryCurrentIndex");
> +static CFStringRef SessionHistoryEntriesKey = CFSTR("SessionHistoryEntries");
> +static CFStringRef SessionHistoryEntryTitleKey = CFSTR("SessionHistoryEntryTitle");
> +static CFStringRef SessionHistoryEntryURLKey = CFSTR("SessionHistoryEntryURL");
> +static CFStringRef SessionHistoryEntryOriginalURLKey = CFSTR("SessionHistoryEntryOriginalURL");
> +static CFStringRef SessionHistoryEntryDataKey = CFSTR("SessionHistoryEntryData");

Very nice. I think all these names should start with a lower case s.

> Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp:45
> +static CFStringRef SessionHistoryKey = CFSTR("SessionHistory");
> +static CFStringRef ProvisionalURLKey = CFSTR("ProvisionalURL");

Lowercase s and p.

> Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:50
> +    static uint64_t identifier = 1;
> +    return identifier++;

static uint64_t identifier;
return ++identifier;
Comment 4 Sam Weinig 2013-12-23 19:24:32 PST
Committed r161045: <http://trac.webkit.org/changeset/161045>