Commit 2c2dbf97 authored by andersca@apple.com's avatar andersca@apple.com

<https://webkit.org/b/119771> Use NeverDestroyed for smart pointer slot static locals

Reviewed by Andreas Kling.

This is preparation for making it a hard error to use DEFINE_STATIC_LOCAL with smart pointer types.

* dom/UserTypingGestureIndicator.cpp:
(WebCore::focusedNode):
* page/mac/EventHandlerMac.mm:
(WebCore::currentNSEventSlot):
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::defaultNetworkStorageSession):
(WebCore::cookieStorageOverride):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6f5fcda3
2013-08-13 Anders Carlsson <andersca@apple.com>
<https://webkit.org/b/119771> Use NeverDestroyed for smart pointer slot static locals
Reviewed by Andreas Kling.
This is preparation for making it a hard error to use DEFINE_STATIC_LOCAL with smart pointer types.
* dom/UserTypingGestureIndicator.cpp:
(WebCore::focusedNode):
* page/mac/EventHandlerMac.mm:
(WebCore::currentNSEventSlot):
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::defaultNetworkStorageSession):
(WebCore::cookieStorageOverride):
2013-08-13 Anders Carlsson <andersca@apple.com>
Stop using DEFINE_STATIC_LOCAL with RefPtr
......@@ -29,7 +29,7 @@
#include "Document.h"
#include "Element.h"
#include "Frame.h"
#include <wtf/StdLibExtras.h>
#include <wtf/NeverDestroyed.h>
namespace WebCore {
......@@ -41,7 +41,7 @@ bool UserTypingGestureIndicator::processingUserTypingGesture()
static RefPtr<Node>& focusedNode()
{
DEFINE_STATIC_LOCAL(RefPtr<Node>, node, ());
static NeverDestroyed<RefPtr<Node>> node;
return node;
}
......
......@@ -49,8 +49,8 @@
#include "Settings.h"
#include "WebCoreSystemInterface.h"
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/ObjcRuntimeExtras.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
......@@ -60,7 +60,7 @@ const double EventHandler::TextDragDelay = 0.15;
static RetainPtr<NSEvent>& currentNSEventSlot()
{
DEFINE_STATIC_LOCAL(RetainPtr<NSEvent>, event, ());
static NeverDestroyed<RetainPtr<NSEvent>> event;
return event;
}
......
......@@ -27,6 +27,7 @@
#include "NetworkStorageSession.h"
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/PassOwnPtr.h>
#if PLATFORM(MAC)
......@@ -46,7 +47,7 @@ NetworkStorageSession::NetworkStorageSession(RetainPtr<CFURLStorageSessionRef> p
static OwnPtr<NetworkStorageSession>& defaultNetworkStorageSession()
{
ASSERT(isMainThread());
DEFINE_STATIC_LOCAL(OwnPtr<NetworkStorageSession>, session, ());
static NeverDestroyed<OwnPtr<NetworkStorageSession>> session;
return session;
}
......@@ -64,7 +65,7 @@ void NetworkStorageSession::switchToNewTestingSession()
#if PLATFORM(WIN)
static RetainPtr<CFHTTPCookieStorageRef>& cookieStorageOverride()
{
DEFINE_STATIC_LOCAL(RetainPtr<CFHTTPCookieStorageRef>, cookieStorage, ());
static NeverDestroyed<RetainPtr<CFHTTPCookieStorageRef>> cookieStorage;
return cookieStorage;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment