Changeset 161045 in webkit


Ignore:
Timestamp:
Dec 23, 2013 7:28:01 PM (10 years ago)
Author:
weinig@apple.com
Message:

[WK2] Replace usage of DEFINE_STATIC_LOCAL with NeverDestroyed
https://bugs.webkit.org/show_bug.cgi?id=126144

Reviewed by Anders Carlsson.

  • DatabaseProcess/DatabaseProcess.cpp:

(WebKit::DatabaseProcess::shared):

  • DatabaseProcess/DatabaseProcess.h:
  • NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:

(WebKit::NetworkBlobRegistry::shared):

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::shared):
(WebKit::NetworkProcess::downloadManager):

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcessPlatformStrategies.cpp:

(WebKit::NetworkProcessPlatformStrategies::initialize):

  • NetworkProcess/mac/RemoteNetworkingContext.mm:

(WebKit::privateBrowsingStorageSessionIdentifierBase):

  • Platform/CoreIPC/Connection.cpp:

(CoreIPC::Connection::SyncMessageState::syncMessageStateMap):
(CoreIPC::Connection::SyncMessageState::syncMessageStateMapMutex):

  • PluginProcess/PluginProcess.cpp:

(WebKit::PluginProcess::shared):

  • PluginProcess/PluginProcess.h:
  • PluginProcess/mac/PluginProcessMac.mm:

(WebKit::fullscreenWindowTracker):

  • Shared/ConnectionStack.cpp:

(WebKit::ConnectionStack::shared):

  • Shared/Plugins/Netscape/NetscapePluginModule.cpp:

(WebKit::initializedNetscapePluginModules):

  • Shared/WebContextMenuItem.cpp:

(WebKit::WebContextMenuItem::separatorItem):

  • Shared/WebPreferencesStore.cpp:

(WebKit::boolTestRunnerOverridesMap):

  • Shared/mac/CookieStorageShim.cpp:

(WebKit::CookieStorageShim::shared):

  • Shared/mac/CookieStorageShim.h:

(WebKit::CookieStorageShim::CookieStorageShim):

  • UIProcess/Plugins/PluginProcessManager.cpp:

(WebKit::PluginProcessManager::shared):

  • UIProcess/Plugins/PluginProcessManager.h:
  • UIProcess/WebContext.cpp:

(WebKit::contexts):

  • UIProcess/WebDatabaseManagerProxy.cpp:

(WebKit::WebDatabaseManagerProxy::originKey):
(WebKit::WebDatabaseManagerProxy::originQuotaKey):
(WebKit::WebDatabaseManagerProxy::originUsageKey):
(WebKit::WebDatabaseManagerProxy::databaseDetailsKey):
(WebKit::WebDatabaseManagerProxy::databaseDetailsNameKey):
(WebKit::WebDatabaseManagerProxy::databaseDetailsDisplayNameKey):
(WebKit::WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey):
(WebKit::WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey):

  • UIProcess/WebInspectorProxy.cpp:

(WebKit::WebInspectorPageGroups::shared):

  • UIProcess/WebPageGroup.cpp:

(WebKit::webPageGroupMap):

  • UIProcess/WebPageProxy.cpp:

(WebKit::ExceededDatabaseQuotaRecords::shared):
(WebKit::WebPageProxy::executeEditCommand):

  • UIProcess/WebProcessProxy.cpp:

(WebKit::globalPageMap):

  • UIProcess/cf/WebBackForwardListCF.cpp:

(WebKit::SessionHistoryCurrentVersion):
(WebKit::createEmptySessionHistoryDictionary):
(WebKit::WebBackForwardList::createCFDictionaryRepresentation):
(WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation):
(WebKit::WebBackForwardList::restoreFromV0CFDictionaryRepresentation):
(WebKit::WebBackForwardList::restoreFromV1CFDictionaryRepresentation):
(WebKit::extractBackForwardListEntriesFromArray):

  • UIProcess/cf/WebPageProxyCF.cpp:

(WebKit::WebPageProxy::sessionStateData):
(WebKit::WebPageProxy::restoreFromSessionStateData):

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::standardUserAgent):

  • WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:

(WebKit::sharedDatabaseBackendMap):

  • WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:

(WebKit::generateServerConnectionIdentifier):

  • WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:

(WebKit::WKDOMNodeCache):
(WebKit::WKDOMRangeCache):

  • WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:

(WebKit::domHandleCache):

  • WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:

(WebKit::domHandleCache):

  • WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:

(WebKit::allExtensions):

  • WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:

(WebKit::allWorlds):

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::globalExceptionString):

  • WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:

(WebKit::windowMap):

  • WebProcess/Storage/StorageNamespaceImpl.cpp:

(WebKit::localStorageNamespaceMap):

  • WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::WebEditorClient::didBeginEditing):
(WebKit::WebEditorClient::respondToChangedContents):
(WebKit::WebEditorClient::respondToChangedSelection):
(WebKit::WebEditorClient::didEndEditing):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::shouldFallBack):

  • WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:

(WebKit::WebPlatformStrategies::initialize):

  • WebProcess/WebCoreSupport/WebPlatformStrategies.h:
  • WebProcess/WebPage/WebBackForwardListProxy.cpp:

(WebKit::idToHistoryItemMap):
(WebKit::historyItemToIDMap):

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::downloadManager):

  • WebProcess/WebProcess.h:
  • config.h:
Location:
trunk/Source/WebKit2
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r161035 r161045  
     12013-12-22  Sam Weinig  <sam@webkit.org>
     2
     3        [WK2] Replace usage of DEFINE_STATIC_LOCAL with NeverDestroyed
     4        https://bugs.webkit.org/show_bug.cgi?id=126144
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * DatabaseProcess/DatabaseProcess.cpp:
     9        (WebKit::DatabaseProcess::shared):
     10        * DatabaseProcess/DatabaseProcess.h:
     11        * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
     12        (WebKit::NetworkBlobRegistry::shared):
     13        * NetworkProcess/NetworkProcess.cpp:
     14        (WebKit::NetworkProcess::shared):
     15        (WebKit::NetworkProcess::downloadManager):
     16        * NetworkProcess/NetworkProcess.h:
     17        * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
     18        (WebKit::NetworkProcessPlatformStrategies::initialize):
     19        * NetworkProcess/mac/RemoteNetworkingContext.mm:
     20        (WebKit::privateBrowsingStorageSessionIdentifierBase):
     21        * Platform/CoreIPC/Connection.cpp:
     22        (CoreIPC::Connection::SyncMessageState::syncMessageStateMap):
     23        (CoreIPC::Connection::SyncMessageState::syncMessageStateMapMutex):
     24        * PluginProcess/PluginProcess.cpp:
     25        (WebKit::PluginProcess::shared):
     26        * PluginProcess/PluginProcess.h:
     27        * PluginProcess/mac/PluginProcessMac.mm:
     28        (WebKit::fullscreenWindowTracker):
     29        * Shared/ConnectionStack.cpp:
     30        (WebKit::ConnectionStack::shared):
     31        * Shared/Plugins/Netscape/NetscapePluginModule.cpp:
     32        (WebKit::initializedNetscapePluginModules):
     33        * Shared/WebContextMenuItem.cpp:
     34        (WebKit::WebContextMenuItem::separatorItem):
     35        * Shared/WebPreferencesStore.cpp:
     36        (WebKit::boolTestRunnerOverridesMap):
     37        * Shared/mac/CookieStorageShim.cpp:
     38        (WebKit::CookieStorageShim::shared):
     39        * Shared/mac/CookieStorageShim.h:
     40        (WebKit::CookieStorageShim::CookieStorageShim):
     41        * UIProcess/Plugins/PluginProcessManager.cpp:
     42        (WebKit::PluginProcessManager::shared):
     43        * UIProcess/Plugins/PluginProcessManager.h:
     44        * UIProcess/WebContext.cpp:
     45        (WebKit::contexts):
     46        * UIProcess/WebDatabaseManagerProxy.cpp:
     47        (WebKit::WebDatabaseManagerProxy::originKey):
     48        (WebKit::WebDatabaseManagerProxy::originQuotaKey):
     49        (WebKit::WebDatabaseManagerProxy::originUsageKey):
     50        (WebKit::WebDatabaseManagerProxy::databaseDetailsKey):
     51        (WebKit::WebDatabaseManagerProxy::databaseDetailsNameKey):
     52        (WebKit::WebDatabaseManagerProxy::databaseDetailsDisplayNameKey):
     53        (WebKit::WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey):
     54        (WebKit::WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey):
     55        * UIProcess/WebInspectorProxy.cpp:
     56        (WebKit::WebInspectorPageGroups::shared):
     57        * UIProcess/WebPageGroup.cpp:
     58        (WebKit::webPageGroupMap):
     59        * UIProcess/WebPageProxy.cpp:
     60        (WebKit::ExceededDatabaseQuotaRecords::shared):
     61        (WebKit::WebPageProxy::executeEditCommand):
     62        * UIProcess/WebProcessProxy.cpp:
     63        (WebKit::globalPageMap):
     64        * UIProcess/cf/WebBackForwardListCF.cpp:
     65        (WebKit::SessionHistoryCurrentVersion):
     66        (WebKit::createEmptySessionHistoryDictionary):
     67        (WebKit::WebBackForwardList::createCFDictionaryRepresentation):
     68        (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation):
     69        (WebKit::WebBackForwardList::restoreFromV0CFDictionaryRepresentation):
     70        (WebKit::WebBackForwardList::restoreFromV1CFDictionaryRepresentation):
     71        (WebKit::extractBackForwardListEntriesFromArray):
     72        * UIProcess/cf/WebPageProxyCF.cpp:
     73        (WebKit::WebPageProxy::sessionStateData):
     74        (WebKit::WebPageProxy::restoreFromSessionStateData):
     75        * UIProcess/mac/WebPageProxyMac.mm:
     76        (WebKit::WebPageProxy::standardUserAgent):
     77        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
     78        (WebKit::sharedDatabaseBackendMap):
     79        * WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp:
     80        (WebKit::generateServerConnectionIdentifier):
     81        * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
     82        (WebKit::WKDOMNodeCache):
     83        (WebKit::WKDOMRangeCache):
     84        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
     85        (WebKit::domHandleCache):
     86        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
     87        (WebKit::domHandleCache):
     88        * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp:
     89        (WebKit::allExtensions):
     90        * WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
     91        (WebKit::allWorlds):
     92        * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:
     93        (WebKit::globalExceptionString):
     94        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
     95        (WebKit::windowMap):
     96        * WebProcess/Storage/StorageNamespaceImpl.cpp:
     97        (WebKit::localStorageNamespaceMap):
     98        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     99        (WebKit::WebEditorClient::didBeginEditing):
     100        (WebKit::WebEditorClient::respondToChangedContents):
     101        (WebKit::WebEditorClient::respondToChangedSelection):
     102        (WebKit::WebEditorClient::didEndEditing):
     103        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     104        (WebKit::WebFrameLoaderClient::shouldFallBack):
     105        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
     106        (WebKit::WebPlatformStrategies::initialize):
     107        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
     108        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
     109        (WebKit::idToHistoryItemMap):
     110        (WebKit::historyItemToIDMap):
     111        * WebProcess/WebProcess.cpp:
     112        (WebKit::WebProcess::downloadManager):
     113        * WebProcess/WebProcess.h:
     114        * config.h:
     115
    11162013-12-23  Tim Horton  <timothy_horton@apple.com>
    2117
  • trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp

    r160517 r161045  
    4343DatabaseProcess& DatabaseProcess::shared()
    4444{
    45     DEFINE_STATIC_LOCAL(DatabaseProcess, databaseProcess, ());
     45    static NeverDestroyed<DatabaseProcess> databaseProcess;
    4646    return databaseProcess;
    4747}
  • trunk/Source/WebKit2/DatabaseProcess/DatabaseProcess.h

    r160555 r161045  
    3131#include "ChildProcess.h"
    3232#include "UniqueIDBDatabaseIdentifier.h"
     33#include <wtf/NeverDestroyed.h>
    3334
    3435class WorkQueue;
     
    4445class DatabaseProcess : public ChildProcess  {
    4546    WTF_MAKE_NONCOPYABLE(DatabaseProcess);
     47    friend NeverDestroyed<DatabaseProcess>;
    4648public:
    4749    static DatabaseProcess& shared();
  • trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp

    r156688 r161045  
    3232#include <WebCore/BlobRegistryImpl.h>
    3333#include <wtf/MainThread.h>
     34#include <wtf/NeverDestroyed.h>
    3435
    3536using namespace WebCore;
     
    4041{
    4142    ASSERT(isMainThread());
    42     DEFINE_STATIC_LOCAL(NetworkBlobRegistry, registry, ());
     43    static NeverDestroyed<NetworkBlobRegistry> registry;
    4344    return registry;
    4445}
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r160308 r161045  
    5858NetworkProcess& NetworkProcess::shared()
    5959{
    60     DEFINE_STATIC_LOCAL(NetworkProcess, networkProcess, ());
     60    static NeverDestroyed<NetworkProcess> networkProcess;
    6161    return networkProcess;
    6262}
     
    8989DownloadManager& NetworkProcess::downloadManager()
    9090{
    91     DEFINE_STATIC_LOCAL(DownloadManager, downloadManager, (this));
     91    static NeverDestroyed<DownloadManager> downloadManager(this);
    9292    return downloadManager;
    9393}
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h

    r160487 r161045  
    3535#include "NetworkResourceLoadScheduler.h"
    3636#include <wtf/Forward.h>
     37#include <wtf/NeverDestroyed.h>
    3738
    3839namespace WebCore {
     
    4849class NetworkProcess : public ChildProcess, private DownloadManager::Client {
    4950    WTF_MAKE_NONCOPYABLE(NetworkProcess);
     51    friend NeverDestroyed<NetworkProcess>;
     52    friend NeverDestroyed<DownloadManager>;
    5053public:
    5154    static NetworkProcess& shared();
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp

    r157700 r161045  
    2828
    2929#include <WebCore/BlobRegistryImpl.h>
     30#include <wtf/NeverDestroyed.h>
    3031
    3132using namespace WebCore;
     
    3536void NetworkProcessPlatformStrategies::initialize()
    3637{
    37     DEFINE_STATIC_LOCAL(NetworkProcessPlatformStrategies, platformStrategies, ());
    38     setPlatformStrategies(&platformStrategies);
     38    static NeverDestroyed<NetworkProcessPlatformStrategies> platformStrategies;
     39    setPlatformStrategies(&platformStrategies.get());
    3940}
    4041
  • trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm

    r157337 r161045  
    9595{
    9696    ASSERT(isMainThread());
    97     DEFINE_STATIC_LOCAL(String, base, ());
     97    static NeverDestroyed<String> base;
    9898    return base;
    9999}
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp

    r161007 r161045  
    2929#include <wtf/CurrentTime.h>
    3030#include <wtf/HashSet.h>
     31#include <wtf/NeverDestroyed.h>
    3132#include <wtf/RunLoop.h>
    3233#include <wtf/text/WTFString.h>
     
    6465    static SyncMessageStateMap& syncMessageStateMap()
    6566    {
    66         DEFINE_STATIC_LOCAL(SyncMessageStateMap, syncMessageStateMap, ());
     67        static NeverDestroyed<SyncMessageStateMap> syncMessageStateMap;
    6768        return syncMessageStateMap;
    6869    }
     
    7071    static Mutex& syncMessageStateMapMutex()
    7172    {
    72         DEFINE_STATIC_LOCAL(Mutex, syncMessageStateMapMutex, ());
     73        static NeverDestroyed<Mutex> syncMessageStateMapMutex;
    7374        return syncMessageStateMapMutex;
    7475    }
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp

    r160308 r161045  
    5151PluginProcess& PluginProcess::shared()
    5252{
    53     DEFINE_STATIC_LOCAL(PluginProcess, pluginProcess, ());
     53    static NeverDestroyed<PluginProcess> pluginProcess;
    5454    return pluginProcess;
    5555}
  • trunk/Source/WebKit2/PluginProcess/PluginProcess.h

    r159001 r161045  
    3131#include "ChildProcess.h"
    3232#include <wtf/Forward.h>
     33#include <wtf/NeverDestroyed.h>
    3334#include <wtf/text/WTFString.h>
    3435
     
    4142class PluginProcess : public ChildProcess {
    4243    WTF_MAKE_NONCOPYABLE(PluginProcess);
     44    friend NeverDestroyed<PluginProcess>;
    4345public:
    4446    static PluginProcess& shared();
  • trunk/Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm

    r159437 r161045  
    4444#import <sysexits.h>
    4545#import <wtf/HashSet.h>
     46#import <wtf/NeverDestroyed.h>
    4647
    4748using namespace WebCore;
     
    128129static FullscreenWindowTracker& fullscreenWindowTracker()
    129130{
    130     DEFINE_STATIC_LOCAL(FullscreenWindowTracker, fullscreenWindowTracker, ());
     131    static NeverDestroyed<FullscreenWindowTracker> fullscreenWindowTracker;
    131132    return fullscreenWindowTracker;
    132133}
  • trunk/Source/WebKit2/Shared/ConnectionStack.cpp

    r131861 r161045  
    2727#include "ConnectionStack.h"
    2828
     29#include <wtf/NeverDestroyed.h>
     30
    2931namespace WebKit {
    3032
    3133ConnectionStack& ConnectionStack::shared()
    3234{
    33     DEFINE_STATIC_LOCAL(ConnectionStack, connectionStack, ());
    34 
     35    static NeverDestroyed<ConnectionStack> connectionStack;
    3536    return connectionStack;
    3637}
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/NetscapePluginModule.cpp

    r159437 r161045  
    3232#include "NPRuntimeUtilities.h"
    3333#include "NetscapeBrowserFuncs.h"
     34#include <wtf/NeverDestroyed.h>
    3435#include <wtf/text/CString.h>
    3536
     
    3839static Vector<NetscapePluginModule*>& initializedNetscapePluginModules()
    3940{
    40     DEFINE_STATIC_LOCAL(Vector<NetscapePluginModule*>, initializedNetscapePluginModules, ());
     41    static NeverDestroyed<Vector<NetscapePluginModule*>> initializedNetscapePluginModules;
    4142    return initializedNetscapePluginModules;
    4243}
  • trunk/Source/WebKit2/Shared/WebContextMenuItem.cpp

    r159269 r161045  
    3232#include "APIArray.h"
    3333#include <WebCore/ContextMenuItem.h>
     34#include <wtf/NeverDestroyed.h>
    3435
    3536namespace WebKit {
     
    5859WebContextMenuItem* WebContextMenuItem::separatorItem()
    5960{
    60     DEFINE_STATIC_LOCAL(WebContextMenuItem*, separatorItem, (adoptRef(new WebContextMenuItem(WebContextMenuItemData(WebCore::SeparatorType, WebCore::ContextMenuItemTagNoAction, String(), true, false))).leakRef()));
     61    static WebContextMenuItem* separatorItem = new WebContextMenuItem(WebContextMenuItemData(WebCore::SeparatorType, WebCore::ContextMenuItemTagNoAction, String(), true, false));
    6162    return separatorItem;
    6263}
  • trunk/Source/WebKit2/Shared/WebPreferencesStore.cpp

    r145961 r161045  
    3030#include "WebCoreArgumentCoders.h"
    3131#include <WebCore/Settings.h>
     32#include <wtf/NeverDestroyed.h>
    3233
    3334namespace WebKit {
     
    3839        const String& KeyLower##Key() \
    3940        { \
    40             DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral(#KeyUpper))); \
     41            static NeverDestroyed<String> key(ASCIILiteral(#KeyUpper)); \
    4142            return key; \
    4243        }
     
    5253static BoolOverridesMap& boolTestRunnerOverridesMap()
    5354{
    54     DEFINE_STATIC_LOCAL(BoolOverridesMap, map, ());
     55    static NeverDestroyed<BoolOverridesMap> map;
    5556    return map;
    5657}
  • trunk/Source/WebKit2/Shared/mac/CookieStorageShim.cpp

    r156550 r161045  
    5959CookieStorageShim& CookieStorageShim::shared()
    6060{
    61     DEFINE_STATIC_LOCAL(CookieStorageShim, storage, ());
     61    static NeverDestroyed<CookieStorageShim> storage;
    6262    return storage;
    6363}
  • trunk/Source/WebKit2/Shared/mac/CookieStorageShim.h

    r149074 r161045  
    3030
    3131#include <wtf/Noncopyable.h>
     32#include <wtf/NeverDestroyed.h>
    3233
    3334namespace WebKit {
     
    3536class CookieStorageShim {
    3637    WTF_MAKE_NONCOPYABLE(CookieStorageShim);
     38    friend NeverDestroyed<CookieStorageShim>;
    3739public:
    3840    static CookieStorageShim& shared();
     
    4143
    4244private:
    43     CookieStorageShim() { };
     45    CookieStorageShim()
     46    {
     47    }
    4448};
    4549
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.cpp

    r156069 r161045  
    3939PluginProcessManager& PluginProcessManager::shared()
    4040{
    41     DEFINE_STATIC_LOCAL(PluginProcessManager, pluginProcessManager, ());
     41    static NeverDestroyed<PluginProcessManager> pluginProcessManager;
    4242    return pluginProcessManager;
    4343}
  • trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h

    r156069 r161045  
    3535#include <wtf/Forward.h>
    3636#include <wtf/HashSet.h>
     37#include <wtf/NeverDestroyed.h>
    3738#include <wtf/Noncopyable.h>
    3839#include <wtf/Vector.h>
     
    5152class PluginProcessManager {
    5253    WTF_MAKE_NONCOPYABLE(PluginProcessManager);
     54    friend NeverDestroyed<PluginProcessManager>;
    5355public:
    5456    static PluginProcessManager& shared();
  • trunk/Source/WebKit2/UIProcess/WebContext.cpp

    r160986 r161045  
    115115static Vector<WebContext*>& contexts()
    116116{
    117     DEFINE_STATIC_LOCAL(Vector<WebContext*>, contexts, ());
    118 
     117    static NeverDestroyed<Vector<WebContext*>> contexts;
    119118    return contexts;
    120119}
  • trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp

    r160608 r161045  
    3535#include "WebDatabaseManagerProxyMessages.h"
    3636#include "WebSecurityOrigin.h"
     37#include <wtf/NeverDestroyed.h>
    3738
    3839using namespace WebCore;
     
    4748String WebDatabaseManagerProxy::originKey()
    4849{
    49     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerOriginKey")));
     50    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerOriginKey"));
    5051    return key;
    5152}
     
    5354String WebDatabaseManagerProxy::originQuotaKey()
    5455{
    55     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerOriginQuotaKey")));
     56    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerOriginQuotaKey"));
    5657    return key;
    5758}
     
    5960String WebDatabaseManagerProxy::originUsageKey()
    6061{
    61     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerOriginUsageKey")));
     62    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerOriginUsageKey"));
    6263    return key;
    6364}
     
    6566String WebDatabaseManagerProxy::databaseDetailsKey()
    6667{
    67     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerDatabaseDetailsKey")));
     68    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsKey"));
    6869    return key;
    6970}
     
    7172String WebDatabaseManagerProxy::databaseDetailsNameKey()
    7273{
    73     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerDatabaseDetailsNameKey")));
     74    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsNameKey"));
    7475    return key;
    7576}
     
    7778String WebDatabaseManagerProxy::databaseDetailsDisplayNameKey()
    7879{
    79     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerDatabaseDetailsDisplayNameKey")));
     80    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsDisplayNameKey"));
    8081    return key;
    8182}
     
    8384String WebDatabaseManagerProxy::databaseDetailsExpectedUsageKey()
    8485{
    85     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerDatabaseDetailsExpectedUsageKey")));
     86    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsExpectedUsageKey"));
    8687    return key;
    8788}
     
    8990String WebDatabaseManagerProxy::databaseDetailsCurrentUsageKey()
    9091{
    91     DEFINE_STATIC_LOCAL(String, key, (ASCIILiteral("WebDatabaseManagerDatabaseDetailsCurrentUsageKey")));
     92    static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsCurrentUsageKey"));
    9293    return key;
    9394}
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp

    r160737 r161045  
    4141#include "WebProcessProxy.h"
    4242#include <WebCore/SchemeRegistry.h>
     43#include <wtf/NeverDestroyed.h>
    4344
    4445#if ENABLE(INSPECTOR_SERVER)
     
    6364    static WebInspectorPageGroups& shared()
    6465    {
    65         DEFINE_STATIC_LOCAL(WebInspectorPageGroups, instance, ());
     66        static NeverDestroyed<WebInspectorPageGroups> instance;
    6667        return instance;
    6768    }
  • trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp

    r160727 r161045  
    3232#include "WebPreferences.h"
    3333#include <wtf/HashMap.h>
     34#include <wtf/NeverDestroyed.h>
    3435#include <wtf/text/StringConcatenate.h>
    3536
     
    4647static WebPageGroupMap& webPageGroupMap()
    4748{
    48     DEFINE_STATIC_LOCAL(WebPageGroupMap, map, ());
     49    static NeverDestroyed<WebPageGroupMap> map;
    4950    return map;
    5051}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r161007 r161045  
    9191#include <WebCore/TextCheckerClient.h>
    9292#include <WebCore/WindowFeatures.h>
     93#include <wtf/NeverDestroyed.h>
    9394#include <stdio.h>
    9495
     
    130131class ExceededDatabaseQuotaRecords {
    131132    WTF_MAKE_NONCOPYABLE(ExceededDatabaseQuotaRecords); WTF_MAKE_FAST_ALLOCATED;
     133    friend NeverDestroyed<ExceededDatabaseQuotaRecords>;
    132134public:
    133135    struct Record {
     
    164166ExceededDatabaseQuotaRecords& ExceededDatabaseQuotaRecords::shared()
    165167{
    166     DEFINE_STATIC_LOCAL(ExceededDatabaseQuotaRecords, records, ());
     168    static NeverDestroyed<ExceededDatabaseQuotaRecords> records;
    167169    return records;
    168170}
     
    10591061void WebPageProxy::executeEditCommand(const String& commandName)
    10601062{
    1061     if (!isValid())
    1062         return;
    1063 
    1064     DEFINE_STATIC_LOCAL(String, ignoreSpellingCommandName, (ASCIILiteral("ignoreSpelling")));
     1063    static NeverDestroyed<String> ignoreSpellingCommandName(ASCIILiteral("ignoreSpelling"));
     1064
     1065    if (!isValid())
     1066        return;
     1067
    10651068    if (commandName == ignoreSpellingCommandName)
    10661069        ++m_pendingLearnOrIgnoreWordMessageCount;
  • trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp

    r160727 r161045  
    4747#include <WebCore/URL.h>
    4848#include <stdio.h>
     49#include <wtf/NeverDestroyed.h>
    4950#include <wtf/RunLoop.h>
    5051#include <wtf/text/CString.h>
     
    7576{
    7677    ASSERT(RunLoop::isMain());
    77     DEFINE_STATIC_LOCAL(WebProcessProxy::WebPageProxyMap, pageMap, ());
     78    static NeverDestroyed<WebProcessProxy::WebPageProxyMap> pageMap;
    7879    return pageMap;
    7980}
  • trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp

    r149255 r161045  
    2828
    2929#include "Logging.h"
     30#include <CoreFoundation/CoreFoundation.h>
     31#include <wtf/NeverDestroyed.h>
    3032#include <wtf/RetainPtr.h>
    31 #include <CoreFoundation/CoreFoundation.h>
    3233
    3334using namespace WebCore;
     
    4546}
    4647
    47 static CFIndex currentVersion = 1;
    48 DEFINE_STATIC_GETTER(CFNumberRef, SessionHistoryCurrentVersion, (CFNumberCreate(0, kCFNumberCFIndexType, &currentVersion)));
    49 
    50 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryVersionKey, (CFSTR("SessionHistoryVersion")));
    51 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryCurrentIndexKey, (CFSTR("SessionHistoryCurrentIndex")));
    52 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntriesKey, (CFSTR("SessionHistoryEntries")));
    53 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryTitleKey, (CFSTR("SessionHistoryEntryTitle")));
    54 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryURLKey, (CFSTR("SessionHistoryEntryURL")));
    55 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryOriginalURLKey, (CFSTR("SessionHistoryEntryOriginalURL")));
    56 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryDataKey, (CFSTR("SessionHistoryEntryData")));
     48static CFNumberRef sessionHistoryCurrentVersion()
     49{
     50    static CFIndex currentVersionAsCFIndex = 1;
     51    return CFNumberCreate(0, kCFNumberCFIndexType, &currentVersionAsCFIndex);
     52}
     53
     54static CFStringRef sessionHistoryVersionKey = CFSTR("SessionHistoryVersion");
     55static CFStringRef sessionHistoryCurrentIndexKey = CFSTR("SessionHistoryCurrentIndex");
     56static CFStringRef sessionHistoryEntriesKey = CFSTR("SessionHistoryEntries");
     57static CFStringRef sessionHistoryEntryTitleKey = CFSTR("SessionHistoryEntryTitle");
     58static CFStringRef sessionHistoryEntryURLKey = CFSTR("SessionHistoryEntryURL");
     59static CFStringRef sessionHistoryEntryOriginalURLKey = CFSTR("SessionHistoryEntryOriginalURL");
     60static CFStringRef sessionHistoryEntryDataKey = CFSTR("SessionHistoryEntryData");
    5761
    5862static bool extractBackForwardListEntriesFromArray(CFArrayRef, BackForwardListItemVector&);
     
    6064static CFDictionaryRef createEmptySessionHistoryDictionary()
    6165{
    62     static const void* keys[1] = { SessionHistoryVersionKey() };
    63     static const void* values[1] = { SessionHistoryCurrentVersion() };
     66    static const void* keys[1] = { sessionHistoryVersionKey };
     67    static const void* values[1] = { sessionHistoryCurrentVersion() };
    6468
    6569    return CFDictionaryCreate(0, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
     
    106110        RetainPtr<CFDataRef> entryData = adoptCF(CFDataCreate(kCFAllocatorDefault, m_entries[i]->backForwardData().data(), m_entries[i]->backForwardData().size()));
    107111       
    108         const void* keys[4] = { SessionHistoryEntryURLKey(), SessionHistoryEntryTitleKey(), SessionHistoryEntryOriginalURLKey(), SessionHistoryEntryDataKey() };
     112        const void* keys[4] = { sessionHistoryEntryURLKey, sessionHistoryEntryTitleKey, sessionHistoryEntryOriginalURLKey, sessionHistoryEntryDataKey };
    109113        const void* values[4] = { url.get(), title.get(), originalURL.get(), entryData.get() };
    110114
     
    131135    if (hasCurrentIndex) {
    132136        RetainPtr<CFNumberRef> currentIndexNumber = adoptCF(CFNumberCreate(0, kCFNumberCFIndexType, &currentIndex));
    133         const void* keys[3] = { SessionHistoryVersionKey(), SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() };
    134         const void* values[3] = { SessionHistoryCurrentVersion(), currentIndexNumber.get(), entries.get() };
     137        const void* keys[3] = { sessionHistoryVersionKey, sessionHistoryCurrentIndexKey, sessionHistoryEntriesKey };
     138        const void* values[3] = { sessionHistoryCurrentVersion(), currentIndexNumber.get(), entries.get() };
    135139 
    136140        return CFDictionaryCreate(0, keys, values, 3, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
     
    143147bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef dictionary)
    144148{
    145     CFNumberRef cfVersion = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryVersionKey());
     149    CFNumberRef cfVersion = (CFNumberRef)CFDictionaryGetValue(dictionary, sessionHistoryVersionKey);
    146150    if (!cfVersion) {
    147151        // v0 session history dictionaries did not contain versioning
     
    169173bool WebBackForwardList::restoreFromV0CFDictionaryRepresentation(CFDictionaryRef dictionary)
    170174{
    171     CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryCurrentIndexKey());
     175    CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, sessionHistoryCurrentIndexKey);
    172176    if (!cfIndex || CFGetTypeID(cfIndex) != CFNumberGetTypeID()) {
    173177        LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid current index");
     
    186190    }
    187191
    188     CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, SessionHistoryEntriesKey());
     192    CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, sessionHistoryEntriesKey);
    189193    if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) {
    190194        LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries");
     
    223227bool WebBackForwardList::restoreFromV1CFDictionaryRepresentation(CFDictionaryRef dictionary)
    224228{
    225     CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, SessionHistoryCurrentIndexKey());
     229    CFNumberRef cfIndex = (CFNumberRef)CFDictionaryGetValue(dictionary, sessionHistoryCurrentIndexKey);
    226230    if (!cfIndex) {
    227231        // No current index means the dictionary represents an empty session.
     
    249253    }
    250254
    251     CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, SessionHistoryEntriesKey());
     255    CFArrayRef cfEntries = (CFArrayRef)CFDictionaryGetValue(dictionary, sessionHistoryEntriesKey);
    252256    if (!cfEntries || CFGetTypeID(cfEntries) != CFArrayGetTypeID()) {
    253257        LOG(SessionState, "WebBackForwardList dictionary representation does not have a valid list of entries");
     
    288292        }
    289293       
    290         CFStringRef entryURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryURLKey());
     294        CFStringRef entryURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryURLKey);
    291295        if (!entryURL || CFGetTypeID(entryURL) != CFStringGetTypeID()) {
    292296            LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid URL", (int)i);
     
    294298        }
    295299
    296         CFStringRef entryTitle = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryTitleKey());
     300        CFStringRef entryTitle = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryTitleKey);
    297301        if (!entryTitle || CFGetTypeID(entryTitle) != CFStringGetTypeID()) {
    298302            LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid title", (int)i);
     
    300304        }
    301305
    302         CFStringRef originalURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryOriginalURLKey());
     306        CFStringRef originalURL = (CFStringRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryOriginalURLKey);
    303307        if (!originalURL || CFGetTypeID(originalURL) != CFStringGetTypeID()) {
    304308            LOG(SessionState, "WebBackForwardList entry at index %i does not have a valid original URL", (int)i);
     
    306310        }
    307311
    308         CFDataRef backForwardData = (CFDataRef)CFDictionaryGetValue(entryDictionary, SessionHistoryEntryDataKey());
     312        CFDataRef backForwardData = (CFDataRef)CFDictionaryGetValue(entryDictionary, sessionHistoryEntryDataKey);
    309313        if (!backForwardData || CFGetTypeID(backForwardData) != CFDataGetTypeID()) {
    310314            LOG(SessionState, "WebBackForwardList entry at index %i does not have back/forward data", (int)i);
  • trunk/Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp

    r160653 r161045  
    4242namespace WebKit {
    4343
    44 DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryKey, (CFSTR("SessionHistory")));
    45 DEFINE_STATIC_GETTER(CFStringRef, ProvisionalURLKey, (CFSTR("ProvisionalURL")));
     44static CFStringRef sessionHistoryKey = CFSTR("SessionHistory");
     45static CFStringRef provisionalURLKey = CFSTR("ProvisionalURL");
    4646
    4747static const UInt32 CurrentSessionStateDataVersion = 2;
     
    5555    RetainPtr<CFDictionaryRef> sessionHistoryDictionary = adoptCF(m_backForwardList->createCFDictionaryRepresentation(filter, context));
    5656    if (sessionHistoryDictionary) {
    57         keys[numValues] = SessionHistoryKey();
     57        keys[numValues] = sessionHistoryKey;
    5858        values[numValues] = sessionHistoryDictionary.get();
    5959        ++numValues;
     
    6767        if (!provisionalURL.isEmpty()) {
    6868            provisionalURLString = provisionalURL.createCFString();
    69             keys[numValues] = ProvisionalURLKey();
     69            keys[numValues] = provisionalURLKey;
    7070            values[numValues] = provisionalURLString.get();
    7171            ++numValues;
     
    137137
    138138    CFDictionaryRef backForwardListDictionary = 0;
    139     if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), SessionHistoryKey())) {
     139    if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), sessionHistoryKey)) {
    140140        if (CFGetTypeID(value) != CFDictionaryGetTypeID())
    141141            LOG(SessionState, "SessionState dictionary has a SessionHistory key, but the value is not a dictionary");
     
    145145
    146146    CFStringRef provisionalURL = 0;
    147     if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), ProvisionalURLKey())) {
     147    if (CFTypeRef value = CFDictionaryGetValue(static_cast<CFDictionaryRef>(propertyList.get()), provisionalURLKey)) {
    148148        if (CFGetTypeID(value) != CFStringGetTypeID())
    149149            LOG(SessionState, "SessionState dictionary has a ProvisionalValue key, but the value is not a string");
  • trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

    r160412 r161045  
    4848#import <WebKitSystemInterface.h>
    4949#import <mach-o/dyld.h>
     50#import <wtf/NeverDestroyed.h>
    5051#import <wtf/text/StringConcatenate.h>
    5152
     
    106107String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent)
    107108{
    108     DEFINE_STATIC_LOCAL(String, osVersion, (systemMarketingVersionForUserAgentString()));
    109     DEFINE_STATIC_LOCAL(String, webKitVersion, (userVisibleWebKitVersionString()));
     109    static NeverDestroyed<String> osVersion(systemMarketingVersionForUserAgentString());
     110    static NeverDestroyed<String> webKitVersion(userVisibleWebKitVersionString());
    110111
    111112    if (applicationNameForUserAgent.isEmpty())
    112         return makeString("Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X ", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)");
    113     return makeString("Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X ", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko) ", applicationNameForUserAgent);
     113        return makeString("Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X ", osVersion.get(), ") AppleWebKit/", webKitVersion.get(), " (KHTML, like Gecko)");
     114    return makeString("Mozilla/5.0 (Macintosh; " PROCESSOR " Mac OS X ", osVersion.get(), ") AppleWebKit/", webKitVersion.get(), " (KHTML, like Gecko) ", applicationNameForUserAgent);
    114115}
    115116
  • trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp

    r159737 r161045  
    4040#include <WebCore/SecurityOrigin.h>
    4141#include <wtf/MainThread.h>
     42#include <wtf/NeverDestroyed.h>
    4243
    4344#if ENABLE(INDEXED_DATABASE)
     
    5253static IDBDatabaseBackendMap& sharedDatabaseBackendMap()
    5354{
    54     DEFINE_STATIC_LOCAL(IDBDatabaseBackendMap, databaseBackendMap, ());
     55    static NeverDestroyed<IDBDatabaseBackendMap> databaseBackendMap;
    5556    return databaseBackendMap;
    5657}
  • trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBServerConnection.cpp

    r160732 r161045  
    3737#include "WebProcess.h"
    3838#include "WebToDatabaseProcessConnection.h"
    39 
    4039#include <WebCore/IDBDatabaseMetadata.h>
    4140#include <WebCore/SecurityOrigin.h>
     
    4847{
    4948    ASSERT(isMainThread());
    50     DEFINE_STATIC_LOCAL(uint64_t, identifier, (0));
     49    static uint64_t identifier = 0;
    5150    return ++identifier;
    5251}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm

    r159760 r161045  
    3434#import <WebCore/Range.h>
    3535#import <WebCore/Text.h>
     36#import <wtf/NeverDestroyed.h>
    3637
    3738// Classes to instantiate.
     
    4950DOMCache<WebCore::Node*, WKDOMNode *>& WKDOMNodeCache()
    5051{
    51     typedef DOMCache<WebCore::Node*, WKDOMNode *> Cache;
    52     DEFINE_STATIC_LOCAL(Cache, cache, ());
     52    static NeverDestroyed<DOMCache<WebCore::Node*, WKDOMNode *>> cache;
    5353    return cache;
    5454}
     
    5656DOMCache<WebCore::Range*, WKDOMRange *>& WKDOMRangeCache()
    5757{
    58     typedef DOMCache<WebCore::Range*, WKDOMRange *> Cache;
    59     DEFINE_STATIC_LOCAL(Cache, cache, ());
     58    static NeverDestroyed<DOMCache<WebCore::Range*, WKDOMRange *>> cache;
    6059    return cache;
    6160}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp

    r156688 r161045  
    4949#include <WebCore/RenderObject.h>
    5050#include <wtf/HashMap.h>
     51#include <wtf/NeverDestroyed.h>
    5152#include <wtf/text/WTFString.h>
    5253
     
    6061static DOMHandleCache& domHandleCache()
    6162{
    62     DEFINE_STATIC_LOCAL(DOMHandleCache, cache, ());
     63    static NeverDestroyed<DOMHandleCache> cache;
    6364    return cache;
    6465}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp

    r155729 r161045  
    3131#include <WebCore/Range.h>
    3232#include <wtf/HashMap.h>
     33#include <wtf/NeverDestroyed.h>
    3334
    3435using namespace WebCore;
     
    4041static DOMHandleCache& domHandleCache()
    4142{
    42     DEFINE_STATIC_LOCAL(DOMHandleCache, cache, ());
     43    static NeverDestroyed<DOMHandleCache> cache;
    4344    return cache;
    4445}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp

    r154142 r161045  
    3535#include <WebCore/FrameLoader.h>
    3636#include <wtf/HashMap.h>
     37#include <wtf/NeverDestroyed.h>
    3738
    3839using namespace WebCore;
     
    4344static ExtensionMap& allExtensions()
    4445{
    45     DEFINE_STATIC_LOCAL(ExtensionMap, map, ());
     46    static NeverDestroyed<ExtensionMap> map;
    4647    return map;
    4748}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp

    r156769 r161045  
    3030#include <WebCore/ScriptController.h>
    3131#include <wtf/HashMap.h>
     32#include <wtf/NeverDestroyed.h>
    3233
    3334using namespace WebCore;
     
    3940static WorldMap& allWorlds()
    4041{
    41     DEFINE_STATIC_LOCAL(WorldMap, map, ());
     42    static NeverDestroyed<WorldMap> map;
    4243    return map;
    4344}
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp

    r160208 r161045  
    4545#include <WebCore/PageThrottler.h>
    4646#include <WebCore/ScriptController.h>
     47#include <wtf/NeverDestroyed.h>
    4748
    4849using namespace JSC;
     
    259260static String& globalExceptionString()
    260261{
    261     DEFINE_STATIC_LOCAL(String, exceptionString, ());
     262    static NeverDestroyed<String> exceptionString;
    262263    return exceptionString;
    263264}
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm

    r156598 r161045  
    3737#import <WebCore/NotImplemented.h>
    3838#import <WebKitSystemInterface.h>
     39#import <wtf/NeverDestroyed.h>
    3940
    4041using namespace WebCore;
     
    197198static WindowMap& windowMap()
    198199{
    199     DEFINE_STATIC_LOCAL(WindowMap, windowMap, ());
    200 
     200    static NeverDestroyed<WindowMap windowMap;
    201201    return windowMap;
    202202}
  • trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceImpl.cpp

    r156056 r161045  
    3636#include <WebCore/SecurityOrigin.h>
    3737#include <WebCore/Settings.h>
     38#include <wtf/NeverDestroyed.h>
    3839
    3940using namespace WebCore;
     
    4546static LocalStorageNamespaceMap& localStorageNamespaceMap()
    4647{
    47     DEFINE_STATIC_LOCAL(LocalStorageNamespaceMap, localStorageNamespaceMap, ());
     48    static NeverDestroyed<LocalStorageNamespaceMap> localStorageNamespaceMap;
    4849    return localStorageNamespaceMap;
    4950}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r159856 r161045  
    5151#include <WebCore/UndoStep.h>
    5252#include <WebCore/UserTypingGestureIndicator.h>
     53#include <wtf/NeverDestroyed.h>
    5354
    5455using namespace WebCore;
     
    171172{
    172173    // FIXME: What good is a notification name, if it's always the same?
    173     DEFINE_STATIC_LOCAL(String, WebViewDidBeginEditingNotification, (ASCIILiteral("WebViewDidBeginEditingNotification")));
    174     m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.impl());
     174    static NeverDestroyed<String> WebViewDidBeginEditingNotification(ASCIILiteral("WebViewDidBeginEditingNotification"));
     175    m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.get().impl());
    175176    notImplemented();
    176177}
     
    178179void WebEditorClient::respondToChangedContents()
    179180{
    180     DEFINE_STATIC_LOCAL(String, WebViewDidChangeNotification, (ASCIILiteral("WebViewDidChangeNotification")));
    181     m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.impl());
     181    static NeverDestroyed<String> WebViewDidChangeNotification(ASCIILiteral("WebViewDidChangeNotification"));
     182    m_page->injectedBundleEditorClient().didChange(m_page, WebViewDidChangeNotification.get().impl());
    182183    notImplemented();
    183184}
     
    185186void WebEditorClient::respondToChangedSelection(Frame* frame)
    186187{
    187     DEFINE_STATIC_LOCAL(String, WebViewDidChangeSelectionNotification, (ASCIILiteral("WebViewDidChangeSelectionNotification")));
    188     m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl());
     188    static NeverDestroyed<String> WebViewDidChangeSelectionNotification(ASCIILiteral("WebViewDidChangeSelectionNotification"));
     189    m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.get().impl());
    189190    if (!frame)
    190191        return;
     
    199200void WebEditorClient::didEndEditing()
    200201{
    201     DEFINE_STATIC_LOCAL(String, WebViewDidEndEditingNotification, (ASCIILiteral("WebViewDidEndEditingNotification")));
    202     m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.impl());
     202    static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification"));
     203    m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.get().impl());
    203204    notImplemented();
    204205}
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r160866 r161045  
    7979#include <WebCore/Widget.h>
    8080#include <WebCore/WindowFeatures.h>
     81#include <wtf/NeverDestroyed.h>
    8182
    8283using namespace WebCore;
     
    10741075bool WebFrameLoaderClient::shouldFallBack(const ResourceError& error)
    10751076{
    1076     DEFINE_STATIC_LOCAL(const ResourceError, cancelledError, (this->cancelledError(ResourceRequest())));
    1077     DEFINE_STATIC_LOCAL(const ResourceError, pluginWillHandleLoadError, (this->pluginWillHandleLoadError(ResourceResponse())));
    1078 
    1079     if (error.errorCode() == cancelledError.errorCode() && error.domain() == cancelledError.domain())
     1077    static NeverDestroyed<const ResourceError> cancelledError(this->cancelledError(ResourceRequest()));
     1078    static NeverDestroyed<const ResourceError> pluginWillHandleLoadError(this->pluginWillHandleLoadError(ResourceResponse()));
     1079
     1080    if (error.errorCode() == cancelledError.get().errorCode() && error.domain() == cancelledError.get().domain())
    10801081        return false;
    10811082
    1082     if (error.errorCode() == pluginWillHandleLoadError.errorCode() && error.domain() == pluginWillHandleLoadError.domain())
     1083    if (error.errorCode() == pluginWillHandleLoadError.get().errorCode() && error.domain() == pluginWillHandleLoadError.get().domain())
    10831084        return false;
    10841085
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

    r159228 r161045  
    7575void WebPlatformStrategies::initialize()
    7676{
    77     DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ());
    78     setPlatformStrategies(&platformStrategies);
     77    static NeverDestroyed<WebPlatformStrategies> platformStrategies;
     78    setPlatformStrategies(&platformStrategies.get());
    7979}
    8080
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

    r158170 r161045  
    3636#include <WebCore/StorageStrategy.h>
    3737#include <WebCore/VisitedLinkStrategy.h>
     38#include <wtf/NeverDestroyed.h>
    3839
    3940namespace WebKit {
    4041
    4142class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy, private WebCore::VisitedLinkStrategy {
     43    friend NeverDestroyed<WebPlatformStrategies>;
    4244public:
    4345    static void initialize();
  • trunk/Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp

    r158990 r161045  
    3737#include <WebCore/PageCache.h>
    3838#include <wtf/HashMap.h>
     39#include <wtf/NeverDestroyed.h>
    3940
    4041using namespace WebCore;
     
    5051static IDToHistoryItemMap& idToHistoryItemMap()
    5152{
    52     DEFINE_STATIC_LOCAL(IDToHistoryItemMap, map, ());
     53    static NeverDestroyed<IDToHistoryItemMap> map;;
    5354    return map;
    5455}
     
    5657static HistoryItemToIDMap& historyItemToIDMap()
    5758{
    58     DEFINE_STATIC_LOCAL(HistoryItemToIDMap, map, ());
     59    static NeverDestroyed<HistoryItemToIDMap> map;
    5960    return map;
    6061}
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r160378 r161045  
    473473#endif
    474474
    475     DEFINE_STATIC_LOCAL(DownloadManager, downloadManager, (this));
     475    static NeverDestroyed<DownloadManager> downloadManager(this);
    476476    return downloadManager;
    477477}
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r160986 r161045  
    4141#include <wtf/HashMap.h>
    4242#include <wtf/HashSet.h>
     43#include <wtf/NeverDestroyed.h>
    4344#include <wtf/text/AtomicString.h>
    4445#include <wtf/text/AtomicStringHash.h>
     
    8586
    8687class WebProcess : public ChildProcess, private DownloadManager::Client {
     88    friend NeverDestroyed<DownloadManager>;
    8789public:
    8890    static WebProcess& shared();
  • trunk/Source/WebKit2/config.h

    r160549 r161045  
    4848#endif
    4949
    50 // For defining getters to a static value, where the getters have internal linkage
    51 #define DEFINE_STATIC_GETTER(type, name, arguments) \
    52 static const type& name() \
    53 { \
    54     DEFINE_STATIC_LOCAL(type, name##Value, arguments); \
    55     return name##Value; \
    56 }
    57 
    5850#ifdef __cplusplus
    5951
Note: See TracChangeset for help on using the changeset viewer.