[Win] Debug builds of TestWebKitAPI are crashing.
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Sep 2014 00:39:20 +0000 (00:39 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Sep 2014 00:39:20 +0000 (00:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133553

Reviewed by Dean Jackson.

../WebCore:

Avoid crash on shutdown due to invalid mutex state in the
HashMap debug implementation during a static destruction operation.

* dom/Node.cpp:
(WebCore::ignoreSet): Convert static value into a NeverDestroyed.
(WebCore::Node::trackForDebugging): Use new NeverDestroyed call.
(WebCore::Node::~Node): Ditto.

../WebKit/win:

Switch from global static HashTable to a NeverDestroyed object.
Modify all accessors of the global static to use the new
NeverDestroyed accessor method.

* AccessibleBase.cpp:
(AccessibleBase::AccessibleBase):
(AccessibleBase::~AccessibleBase):
* CFDictionaryPropertyBag.cpp:
(CFDictionaryPropertyBag::CFDictionaryPropertyBag):
(CFDictionaryPropertyBag::~CFDictionaryPropertyBag):
* DefaultDownloadDelegate.cpp:
(DefaultDownloadDelegate::DefaultDownloadDelegate):
(DefaultDownloadDelegate::~DefaultDownloadDelegate):
* DefaultPolicyDelegate.cpp:
(DefaultPolicyDelegate::DefaultPolicyDelegate):
(DefaultPolicyDelegate::~DefaultPolicyDelegate):
* MemoryStream.cpp:
(MemoryStream::MemoryStream):
(MemoryStream::~MemoryStream):
* WebActionPropertyBag.cpp:
(WebActionPropertyBag::WebActionPropertyBag):
(WebActionPropertyBag::~WebActionPropertyBag):
* WebArchive.cpp:
(WebArchive::WebArchive):
(WebArchive::~WebArchive):
* WebBackForwardList.cpp:
(WebBackForwardList::WebBackForwardList):
(WebBackForwardList::~WebBackForwardList):
* WebCache.cpp:
(WebCache::WebCache):
(WebCache::~WebCache):
* WebCookieManager.cpp:
(WebCookieManager::WebCookieManager):
(WebCookieManager::~WebCookieManager):
* WebCoreStatistics.cpp:
(WebCoreStatistics::WebCoreStatistics):
(WebCoreStatistics::~WebCoreStatistics):
* WebDataSource.cpp:
(WebDataSource::~WebDataSource):
* WebDatabaseManager.cpp:
(WebDatabaseManager::WebDatabaseManager):
(WebDatabaseManager::~WebDatabaseManager):
* WebDocumentLoader.cpp:
(WebDocumentLoader::WebDocumentLoader):
(WebDocumentLoader::~WebDocumentLoader):
* WebDownload.cpp:
(WebDownload::WebDownload):
(WebDownload::~WebDownload):
* WebDropSource.cpp:
(WebDropSource::WebDropSource):
(WebDropSource::~WebDropSource):
* WebElementPropertyBag.cpp:
(WebElementPropertyBag::WebElementPropertyBag):
(WebElementPropertyBag::~WebElementPropertyBag):
* WebError.cpp:
(WebError::WebError):
(WebError::~WebError):
* WebFrame.cpp:
(WebFrame::WebFrame):
(WebFrame::~WebFrame):
* WebFramePolicyListener.cpp:
(WebFramePolicyListener::WebFramePolicyListener):
(WebFramePolicyListener::~WebFramePolicyListener):
* WebGeolocationPolicyListener.cpp:
(WebGeolocationPolicyListener::WebGeolocationPolicyListener):
(WebGeolocationPolicyListener::~WebGeolocationPolicyListener):
* WebGeolocationPosition.cpp:
(WebGeolocationPosition::WebGeolocationPosition):
(WebGeolocationPosition::~WebGeolocationPosition):
* WebHTMLRepresentation.cpp:
(WebHTMLRepresentation::WebHTMLRepresentation):
(WebHTMLRepresentation::~WebHTMLRepresentation):
* WebHistory.cpp:
(WebHistory::WebHistory):
(WebHistory::~WebHistory):
* WebHistoryItem.cpp:
(WebHistoryItem::WebHistoryItem):
(WebHistoryItem::~WebHistoryItem):
* WebIconDatabase.cpp:
(WebIconDatabase::WebIconDatabase):
(WebIconDatabase::~WebIconDatabase):
* WebInspector.cpp:
(WebInspector::WebInspector):
(WebInspector::~WebInspector):
* WebJavaScriptCollector.cpp:
(WebJavaScriptCollector::WebJavaScriptCollector):
(WebJavaScriptCollector::~WebJavaScriptCollector):
* WebKitClassFactory.cpp:
(WebKitClassFactory::WebKitClassFactory):
(WebKitClassFactory::~WebKitClassFactory):
* WebKitDLL.cpp: Also switch to NeverDestroyed HashTable for
the global class name count.
* WebKitDLL.h:
* WebKitStatistics.cpp:
(WebKitStatistics::WebKitStatistics):
(WebKitStatistics::~WebKitStatistics):
(WebKitStatistics::comClassNameCounts):
* WebMutableURLRequest.cpp:
(WebMutableURLRequest::WebMutableURLRequest):
(WebMutableURLRequest::~WebMutableURLRequest):
* WebNavigationData.cpp:
(WebNavigationData::WebNavigationData):
(WebNavigationData::~WebNavigationData):
* WebNotification.cpp:
(WebNotification::WebNotification):
(WebNotification::~WebNotification):
* WebNotificationCenter.cpp:
(WebNotificationCenter::WebNotificationCenter):
(WebNotificationCenter::~WebNotificationCenter):
* WebPreferences.cpp:
(webPreferencesInstances):
(WebPreferences::WebPreferences):
(WebPreferences::~WebPreferences):
(WebPreferences::getInstanceForIdentifier):
(WebPreferences::setInstance):
(WebPreferences::removeReferenceForIdentifier):
* WebResource.cpp:
(WebResource::WebResource):
(WebResource::~WebResource):
* WebScriptObject.cpp:
(WebScriptObject::WebScriptObject):
(WebScriptObject::~WebScriptObject):
* WebScriptWorld.cpp:
(WebScriptWorld::WebScriptWorld):
(WebScriptWorld::~WebScriptWorld):
* WebSecurityOrigin.cpp:
(WebSecurityOrigin::WebSecurityOrigin):
(WebSecurityOrigin::~WebSecurityOrigin):
* WebSerializedJSValue.cpp:
(WebSerializedJSValue::WebSerializedJSValue):
(WebSerializedJSValue::~WebSerializedJSValue):
* WebTextRenderer.cpp:
(WebTextRenderer::WebTextRenderer):
(WebTextRenderer::~WebTextRenderer):
* WebURLAuthenticationChallenge.cpp:
(WebURLAuthenticationChallenge::WebURLAuthenticationChallenge):
(WebURLAuthenticationChallenge::~WebURLAuthenticationChallenge):
* WebURLAuthenticationChallengeSender.cpp:
(WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender):
(WebURLAuthenticationChallengeSender::~WebURLAuthenticationChallengeSender):
* WebURLCredential.cpp:
(WebURLCredential::WebURLCredential):
(WebURLCredential::~WebURLCredential):
* WebURLProtectionSpace.cpp:
(WebURLProtectionSpace::WebURLProtectionSpace):
(WebURLProtectionSpace::~WebURLProtectionSpace):
* WebURLResponse.cpp:
(:m_refCount):
(WebURLResponse::~WebURLResponse):
* WebUserContentURLPattern.cpp:
(WebUserContentURLPattern::WebUserContentURLPattern):
(WebUserContentURLPattern::~WebUserContentURLPattern):
* WebView.cpp:
(pendingDeleteBackingStoreSet): Switch from a global static
value to a NeverDestroyed object wrapped by an accessor function.
(WebView::WebView): Ditto.
(WebView::~WebView): Ditto.
(WebView::deleteBackingStore): Ditto.
(WebView::deleteBackingStoreSoon): Ditto,
(WebView::cancelDeleteBackingStoreSoon): Ditto.
* WebWorkersPrivate.cpp: Switch from a global static value for
the preferences objects t a NeverDestroyed container.
(WebWorkersPrivate::WebWorkersPrivate): Ditto.
(WebWorkersPrivate::~WebWorkersPrivate): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173988 268f45cc-cd09-0410-ab3c-d52691b4dbfc

57 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Node.cpp
Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
Source/WebKit/WebKit.vcxproj/WebKit/WebKit.vcxproj
Source/WebKit/win/AccessibleBase.cpp
Source/WebKit/win/CFDictionaryPropertyBag.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/DefaultDownloadDelegate.cpp
Source/WebKit/win/DefaultPolicyDelegate.cpp
Source/WebKit/win/MemoryStream.cpp
Source/WebKit/win/WebActionPropertyBag.cpp
Source/WebKit/win/WebArchive.cpp
Source/WebKit/win/WebBackForwardList.cpp
Source/WebKit/win/WebCache.cpp
Source/WebKit/win/WebCookieManager.cpp
Source/WebKit/win/WebCoreStatistics.cpp
Source/WebKit/win/WebDataSource.cpp
Source/WebKit/win/WebDatabaseManager.cpp
Source/WebKit/win/WebDocumentLoader.cpp
Source/WebKit/win/WebDownload.cpp
Source/WebKit/win/WebDropSource.cpp
Source/WebKit/win/WebElementPropertyBag.cpp
Source/WebKit/win/WebError.cpp
Source/WebKit/win/WebFrame.cpp
Source/WebKit/win/WebFramePolicyListener.cpp
Source/WebKit/win/WebGeolocationPolicyListener.cpp
Source/WebKit/win/WebGeolocationPosition.cpp
Source/WebKit/win/WebHTMLRepresentation.cpp
Source/WebKit/win/WebHistory.cpp
Source/WebKit/win/WebHistoryItem.cpp
Source/WebKit/win/WebIconDatabase.cpp
Source/WebKit/win/WebInspector.cpp
Source/WebKit/win/WebJavaScriptCollector.cpp
Source/WebKit/win/WebKitClassFactory.cpp
Source/WebKit/win/WebKitDLL.cpp
Source/WebKit/win/WebKitDLL.h
Source/WebKit/win/WebKitStatistics.cpp
Source/WebKit/win/WebMutableURLRequest.cpp
Source/WebKit/win/WebNavigationData.cpp
Source/WebKit/win/WebNotification.cpp
Source/WebKit/win/WebNotificationCenter.cpp
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebResource.cpp
Source/WebKit/win/WebScriptObject.cpp
Source/WebKit/win/WebScriptWorld.cpp
Source/WebKit/win/WebSecurityOrigin.cpp
Source/WebKit/win/WebSerializedJSValue.cpp
Source/WebKit/win/WebTextRenderer.cpp
Source/WebKit/win/WebURLAuthenticationChallenge.cpp
Source/WebKit/win/WebURLAuthenticationChallengeSender.cpp
Source/WebKit/win/WebURLCredential.cpp
Source/WebKit/win/WebURLProtectionSpace.cpp
Source/WebKit/win/WebURLResponse.cpp
Source/WebKit/win/WebUserContentURLPattern.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit/win/WebWorkersPrivate.cpp

index 51a86d8..68cdbde 100644 (file)
@@ -1,3 +1,18 @@
+2014-09-25  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Debug builds of TestWebKitAPI are crashing.
+        https://bugs.webkit.org/show_bug.cgi?id=133553
+
+        Reviewed by Dean Jackson.
+
+        Avoid crash on shutdown due to invalid mutex state in the
+        HashMap debug implementation during a static destruction operation.
+
+        * dom/Node.cpp:
+        (WebCore::ignoreSet): Convert static value into a NeverDestroyed.
+        (WebCore::Node::trackForDebugging): Use new NeverDestroyed call.
+        (WebCore::Node::~Node): Ditto.
+
 2014-09-25  Christophe Dumez  <cdumez@apple.com>
 
         Add support for is<SVGDocument>() / downcast<SVGDocument>()
index d1503ff..f6d605c 100644 (file)
@@ -253,10 +253,17 @@ void Node::dumpStatistics()
 }
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, nodeCounter, ("WebCoreNode"));
-DEFINE_DEBUG_ONLY_GLOBAL(HashSet<Node*>, ignoreSet, );
 
 #ifndef NDEBUG
 static bool shouldIgnoreLeaks = false;
+
+static HashSet<Node*>& ignoreSet()
+{
+    static NeverDestroyed<HashSet<Node*>> ignore;
+
+    return ignore;
+}
+
 #endif
 
 void Node::startIgnoringLeaks()
@@ -277,7 +284,7 @@ void Node::trackForDebugging()
 {
 #ifndef NDEBUG
     if (shouldIgnoreLeaks)
-        ignoreSet.add(this);
+        ignoreSet().add(this);
     else
         nodeCounter.increment();
 #endif
@@ -304,7 +311,7 @@ Node::Node(Document& document, ConstructionType type)
 Node::~Node()
 {
 #ifndef NDEBUG
-    if (!ignoreSet.remove(this))
+    if (!ignoreSet().remove(this))
         nodeCounter.decrement();
 #endif
 
index 1cbcf53..ce2d0cd 100644 (file)
@@ -227,6 +227,8 @@ void PDFDocumentImage::createPDFDocument()
 
 void PDFDocumentImage::computeBoundsForCurrentPage()
 {
+    size_t pageCount = CGPDFDocumentGetNumberOfPages(m_document.get());
+    ASSERT(pageCount > 0);
     CGPDFPageRef cgPage = CGPDFDocumentGetPage(m_document.get(), 1);
     CGRect mediaBox = CGPDFPageGetBoxRect(cgPage, kCGPDFMediaBox);
 
index 15d8fa0..26a0e00 100644 (file)
@@ -169,6 +169,7 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData(CFDataRef
 
 void SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading()
 {
+    WTFLogAlways("CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
 #if USE(QUICK_LOOK)
index 56a1041..b71c983 100644 (file)
     <Link />
     <ClCompile />
     <Link />
+    <Link>
+      <OptimizeReferences>false</OptimizeReferences>
+    </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">
     <ClCompile />
     <Link />
     <Link />
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Link>
+      <EnableCOMDATFolding>false</EnableCOMDATFolding>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\..\cf\WebCoreSupport\WebInspectorClientCF.cpp" />
     <ClCompile Include="..\..\win\AccessibleBase.cpp" />
index 82e83c8..96f9b75 100644 (file)
@@ -64,13 +64,13 @@ AccessibleBase::AccessibleBase(AccessibilityObject* obj, HWND window)
     ASSERT_ARG(obj, obj);
     m_object->setWrapper(this);
     ++gClassCount;
-    gClassNameCount.add("AccessibleBase");
+    gClassNameCount().add("AccessibleBase");
 }
 
 AccessibleBase::~AccessibleBase()
 {
     --gClassCount;
-    gClassNameCount.remove("AccessibleBase");
+    gClassNameCount().remove("AccessibleBase");
 }
 
 AccessibleBase* AccessibleBase::createInstance(AccessibilityObject* obj, HWND window)
index c48167a..af73631 100644 (file)
 // CFDictionaryPropertyBag -----------------------------------------------
 
 CFDictionaryPropertyBag::CFDictionaryPropertyBag()
-: m_refCount(0)
+    : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("CFDictionaryPropertyBag");
+    gClassNameCount().add("CFDictionaryPropertyBag");
 }
 
 CFDictionaryPropertyBag::~CFDictionaryPropertyBag()
 {
     gClassCount--;
-    gClassNameCount.remove("CFDictionaryPropertyBag");
+    gClassNameCount().remove("CFDictionaryPropertyBag");
 }
 
 COMPtr<CFDictionaryPropertyBag> CFDictionaryPropertyBag::createInstance()
index 33783ac..10559c5 100644 (file)
@@ -1,3 +1,175 @@
+2014-09-25  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Debug builds of TestWebKitAPI are crashing.
+        https://bugs.webkit.org/show_bug.cgi?id=133553
+
+        Reviewed by Dean Jackson.
+
+        Switch from global static HashTable to a NeverDestroyed object.
+        Modify all accessors of the global static to use the new
+        NeverDestroyed accessor method.
+
+        * AccessibleBase.cpp:
+        (AccessibleBase::AccessibleBase):
+        (AccessibleBase::~AccessibleBase):
+        * CFDictionaryPropertyBag.cpp:
+        (CFDictionaryPropertyBag::CFDictionaryPropertyBag):
+        (CFDictionaryPropertyBag::~CFDictionaryPropertyBag):
+        * DefaultDownloadDelegate.cpp:
+        (DefaultDownloadDelegate::DefaultDownloadDelegate):
+        (DefaultDownloadDelegate::~DefaultDownloadDelegate):
+        * DefaultPolicyDelegate.cpp:
+        (DefaultPolicyDelegate::DefaultPolicyDelegate):
+        (DefaultPolicyDelegate::~DefaultPolicyDelegate):
+        * MemoryStream.cpp:
+        (MemoryStream::MemoryStream):
+        (MemoryStream::~MemoryStream):
+        * WebActionPropertyBag.cpp:
+        (WebActionPropertyBag::WebActionPropertyBag):
+        (WebActionPropertyBag::~WebActionPropertyBag):
+        * WebArchive.cpp:
+        (WebArchive::WebArchive):
+        (WebArchive::~WebArchive):
+        * WebBackForwardList.cpp:
+        (WebBackForwardList::WebBackForwardList):
+        (WebBackForwardList::~WebBackForwardList):
+        * WebCache.cpp:
+        (WebCache::WebCache):
+        (WebCache::~WebCache):
+        * WebCookieManager.cpp:
+        (WebCookieManager::WebCookieManager):
+        (WebCookieManager::~WebCookieManager):
+        * WebCoreStatistics.cpp:
+        (WebCoreStatistics::WebCoreStatistics):
+        (WebCoreStatistics::~WebCoreStatistics):
+        * WebDataSource.cpp:
+        (WebDataSource::~WebDataSource):
+        * WebDatabaseManager.cpp:
+        (WebDatabaseManager::WebDatabaseManager):
+        (WebDatabaseManager::~WebDatabaseManager):
+        * WebDocumentLoader.cpp:
+        (WebDocumentLoader::WebDocumentLoader):
+        (WebDocumentLoader::~WebDocumentLoader):
+        * WebDownload.cpp:
+        (WebDownload::WebDownload):
+        (WebDownload::~WebDownload):
+        * WebDropSource.cpp:
+        (WebDropSource::WebDropSource):
+        (WebDropSource::~WebDropSource):
+        * WebElementPropertyBag.cpp:
+        (WebElementPropertyBag::WebElementPropertyBag):
+        (WebElementPropertyBag::~WebElementPropertyBag):
+        * WebError.cpp:
+        (WebError::WebError):
+        (WebError::~WebError):
+        * WebFrame.cpp:
+        (WebFrame::WebFrame):
+        (WebFrame::~WebFrame):
+        * WebFramePolicyListener.cpp:
+        (WebFramePolicyListener::WebFramePolicyListener):
+        (WebFramePolicyListener::~WebFramePolicyListener):
+        * WebGeolocationPolicyListener.cpp:
+        (WebGeolocationPolicyListener::WebGeolocationPolicyListener):
+        (WebGeolocationPolicyListener::~WebGeolocationPolicyListener):
+        * WebGeolocationPosition.cpp:
+        (WebGeolocationPosition::WebGeolocationPosition):
+        (WebGeolocationPosition::~WebGeolocationPosition):
+        * WebHTMLRepresentation.cpp:
+        (WebHTMLRepresentation::WebHTMLRepresentation):
+        (WebHTMLRepresentation::~WebHTMLRepresentation):
+        * WebHistory.cpp:
+        (WebHistory::WebHistory):
+        (WebHistory::~WebHistory):
+        * WebHistoryItem.cpp:
+        (WebHistoryItem::WebHistoryItem):
+        (WebHistoryItem::~WebHistoryItem):
+        * WebIconDatabase.cpp:
+        (WebIconDatabase::WebIconDatabase):
+        (WebIconDatabase::~WebIconDatabase):
+        * WebInspector.cpp:
+        (WebInspector::WebInspector):
+        (WebInspector::~WebInspector):
+        * WebJavaScriptCollector.cpp:
+        (WebJavaScriptCollector::WebJavaScriptCollector):
+        (WebJavaScriptCollector::~WebJavaScriptCollector):
+        * WebKitClassFactory.cpp:
+        (WebKitClassFactory::WebKitClassFactory):
+        (WebKitClassFactory::~WebKitClassFactory):
+        * WebKitDLL.cpp: Also switch to NeverDestroyed HashTable for
+        the global class name count.
+        * WebKitDLL.h:
+        * WebKitStatistics.cpp:
+        (WebKitStatistics::WebKitStatistics):
+        (WebKitStatistics::~WebKitStatistics):
+        (WebKitStatistics::comClassNameCounts):
+        * WebMutableURLRequest.cpp:
+        (WebMutableURLRequest::WebMutableURLRequest):
+        (WebMutableURLRequest::~WebMutableURLRequest):
+        * WebNavigationData.cpp:
+        (WebNavigationData::WebNavigationData):
+        (WebNavigationData::~WebNavigationData):
+        * WebNotification.cpp:
+        (WebNotification::WebNotification):
+        (WebNotification::~WebNotification):
+        * WebNotificationCenter.cpp:
+        (WebNotificationCenter::WebNotificationCenter):
+        (WebNotificationCenter::~WebNotificationCenter):
+        * WebPreferences.cpp:
+        (webPreferencesInstances):
+        (WebPreferences::WebPreferences):
+        (WebPreferences::~WebPreferences):
+        (WebPreferences::getInstanceForIdentifier):
+        (WebPreferences::setInstance):
+        (WebPreferences::removeReferenceForIdentifier):
+        * WebResource.cpp:
+        (WebResource::WebResource):
+        (WebResource::~WebResource):
+        * WebScriptObject.cpp:
+        (WebScriptObject::WebScriptObject):
+        (WebScriptObject::~WebScriptObject):
+        * WebScriptWorld.cpp:
+        (WebScriptWorld::WebScriptWorld):
+        (WebScriptWorld::~WebScriptWorld):
+        * WebSecurityOrigin.cpp:
+        (WebSecurityOrigin::WebSecurityOrigin):
+        (WebSecurityOrigin::~WebSecurityOrigin):
+        * WebSerializedJSValue.cpp:
+        (WebSerializedJSValue::WebSerializedJSValue):
+        (WebSerializedJSValue::~WebSerializedJSValue):
+        * WebTextRenderer.cpp:
+        (WebTextRenderer::WebTextRenderer):
+        (WebTextRenderer::~WebTextRenderer):
+        * WebURLAuthenticationChallenge.cpp:
+        (WebURLAuthenticationChallenge::WebURLAuthenticationChallenge):
+        (WebURLAuthenticationChallenge::~WebURLAuthenticationChallenge):
+        * WebURLAuthenticationChallengeSender.cpp:
+        (WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender):
+        (WebURLAuthenticationChallengeSender::~WebURLAuthenticationChallengeSender):
+        * WebURLCredential.cpp:
+        (WebURLCredential::WebURLCredential):
+        (WebURLCredential::~WebURLCredential):
+        * WebURLProtectionSpace.cpp:
+        (WebURLProtectionSpace::WebURLProtectionSpace):
+        (WebURLProtectionSpace::~WebURLProtectionSpace):
+        * WebURLResponse.cpp:
+        (:m_refCount):
+        (WebURLResponse::~WebURLResponse):
+        * WebUserContentURLPattern.cpp:
+        (WebUserContentURLPattern::WebUserContentURLPattern):
+        (WebUserContentURLPattern::~WebUserContentURLPattern):
+        * WebView.cpp:
+        (pendingDeleteBackingStoreSet): Switch from a global static
+        value to a NeverDestroyed object wrapped by an accessor function.
+        (WebView::WebView): Ditto.
+        (WebView::~WebView): Ditto.
+        (WebView::deleteBackingStore): Ditto.
+        (WebView::deleteBackingStoreSoon): Ditto,
+        (WebView::cancelDeleteBackingStoreSoon): Ditto.
+        * WebWorkersPrivate.cpp: Switch from a global static value for
+        the preferences objects t a NeverDestroyed container.
+        (WebWorkersPrivate::WebWorkersPrivate): Ditto.
+        (WebWorkersPrivate::~WebWorkersPrivate): Ditto.
+
 2014-09-25  Christophe Dumez  <cdumez@apple.com>
 
         Use is<HTML*Element>() instead of isHTML*Element() - Part 2
index 1b40f24..3eafbaf 100644 (file)
@@ -47,13 +47,13 @@ DefaultDownloadDelegate::DefaultDownloadDelegate()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("DefaultDownloadDelegate");
+    gClassNameCount().add("DefaultDownloadDelegate");
 }
 
 DefaultDownloadDelegate::~DefaultDownloadDelegate()
 {
     gClassCount--;
-    gClassNameCount.remove("DefaultDownloadDelegate");
+    gClassNameCount().remove("DefaultDownloadDelegate");
     HashSet<IWebDownload*>::iterator i = m_downloads.begin();
     for (;i != m_downloads.end(); ++i)
         (*i)->Release();
index 0483e76..1f245a1 100644 (file)
@@ -44,13 +44,13 @@ DefaultPolicyDelegate::DefaultPolicyDelegate()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("DefaultPolicyDelegate");
+    gClassNameCount().add("DefaultPolicyDelegate");
 }
 
 DefaultPolicyDelegate::~DefaultPolicyDelegate()
 {
     gClassCount--;
-    gClassNameCount.remove("DefaultPolicyDelegate");
+    gClassNameCount().remove("DefaultPolicyDelegate");
 }
 
 DefaultPolicyDelegate* DefaultPolicyDelegate::sharedInstance()
index 2bb9587..e40cc4f 100644 (file)
@@ -33,18 +33,18 @@ using namespace WebCore;
 // MemoryStream ---------------------------------------------------------------
 
 MemoryStream::MemoryStream(PassRefPtr<SharedBuffer> buffer)
-: m_refCount(0)
-, m_buffer(buffer)
-, m_pos(0)
+    : m_refCount(0)
+    , m_buffer(buffer)
+    , m_pos(0)
 {
     gClassCount++;
-    gClassNameCount.add("MemoryStream");
+    gClassNameCount().add("MemoryStream");
 }
 
 MemoryStream::~MemoryStream()
 {
     gClassCount--;
-    gClassNameCount.remove("MemoryStream");
+    gClassNameCount().remove("MemoryStream");
 }
 
 COMPtr<MemoryStream> MemoryStream::createInstance(PassRefPtr<SharedBuffer> buffer)
index d11ebb0..5b0a6e4 100644 (file)
@@ -47,13 +47,13 @@ WebActionPropertyBag::WebActionPropertyBag(const NavigationAction& action, PassR
     , m_frame(frame)
 {
     gClassCount++;
-    gClassNameCount.add("WebActionPropertyBag");
+    gClassNameCount().add("WebActionPropertyBag");
 }
 
 WebActionPropertyBag::~WebActionPropertyBag()
 {
     gClassCount--;
-    gClassNameCount.remove("WebActionPropertyBag");
+    gClassNameCount().remove("WebActionPropertyBag");
 }
 
 WebActionPropertyBag* WebActionPropertyBag::createInstance(const NavigationAction& action, PassRefPtr<HTMLFormElement> form, PassRefPtr<Frame> frame)
index 423f198..be57336 100644 (file)
@@ -55,13 +55,13 @@ WebArchive::WebArchive(PassRefPtr<LegacyWebArchive> coreArchive)
     , m_archive(coreArchive)
 {
     gClassCount++;
-    gClassNameCount.add("WebArchive");
+    gClassNameCount().add("WebArchive");
 }
 
 WebArchive::~WebArchive()
 {
     gClassCount--;
-    gClassNameCount.remove("WebArchive");
+    gClassNameCount().remove("WebArchive");
 }
 
 HRESULT STDMETHODCALLTYPE WebArchive::QueryInterface(REFIID riid, void** ppvObject)
index 7acaea2..7adec58 100644 (file)
@@ -56,7 +56,7 @@ WebBackForwardList::WebBackForwardList(PassRefPtr<BackForwardList> backForwardLi
     backForwardListWrappers().set(m_backForwardList.get(), this);
 
     gClassCount++;
-    gClassNameCount.add("WebBackForwardList");
+    gClassNameCount().add("WebBackForwardList");
 }
 
 WebBackForwardList::~WebBackForwardList()
@@ -67,7 +67,7 @@ WebBackForwardList::~WebBackForwardList()
     backForwardListWrappers().remove(m_backForwardList.get());
 
     gClassCount--;
-    gClassNameCount.remove("WebBackForwardList");
+    gClassNameCount().remove("WebBackForwardList");
 }
 
 WebBackForwardList* WebBackForwardList::createInstance(PassRefPtr<BackForwardList> backForwardList)
index d642dad..27f8722 100644 (file)
 // WebCache ---------------------------------------------------------------------------
 
 WebCache::WebCache()
-: m_refCount(0)
+    : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebCache");
+    gClassNameCount().add("WebCache");
 }
 
 WebCache::~WebCache()
 {
     gClassCount--;
-    gClassNameCount.remove("WebCache");
+    gClassNameCount().remove("WebCache");
 }
 
 WebCache* WebCache::createInstance()
index 49bbad6..059d054 100644 (file)
@@ -40,13 +40,13 @@ WebCookieManager::WebCookieManager()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebCookieManager");
+    gClassNameCount().add("WebCookieManager");
 }
 
 WebCookieManager::~WebCookieManager()
 {
     gClassCount--;
-    gClassNameCount.remove("WebCookieManager");
+    gClassNameCount().remove("WebCookieManager");
 }
 
 // IUnknown ---------------------------------------------------------------
index 867b0b7..4cd1456 100644 (file)
@@ -49,13 +49,13 @@ WebCoreStatistics::WebCoreStatistics()
 : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebCoreStatistics");
+    gClassNameCount().add("WebCoreStatistics");
 }
 
 WebCoreStatistics::~WebCoreStatistics()
 {
     gClassCount--;
-    gClassNameCount.remove("WebCoreStatistics");
+    gClassNameCount().remove("WebCoreStatistics");
 }
 
 WebCoreStatistics* WebCoreStatistics::createInstance()
index 8fee8eb..4fbd996 100644 (file)
@@ -61,7 +61,7 @@ WebDataSource::WebDataSource(WebDocumentLoader* loader)
 {
     WebDataSourceCount++;
     gClassCount++;
-    gClassNameCount.add("WebDataSource");
+    gClassNameCount().add("WebDataSource");
 }
 
 WebDataSource::~WebDataSource()
@@ -70,7 +70,7 @@ WebDataSource::~WebDataSource()
         m_loader->detachDataSource();
     WebDataSourceCount--;
     gClassCount--;
-    gClassNameCount.remove("WebDataSource");
+    gClassNameCount().remove("WebDataSource");
 }
 
 WebDataSource* WebDataSource::createInstance(WebDocumentLoader* loader)
index 4ba3c52..cffaec1 100644 (file)
@@ -158,13 +158,13 @@ WebDatabaseManager::WebDatabaseManager()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebDatabaseManager");
+    gClassNameCount().add("WebDatabaseManager");
 }
 
 WebDatabaseManager::~WebDatabaseManager()
 {
     gClassCount--;
-    gClassNameCount.remove("WebDatabaseManager");
+    gClassNameCount().remove("WebDatabaseManager");
 }
 
 // IUnknown ------------------------------------------------------------------------
index 3c734f5..3d18fd9 100644 (file)
@@ -36,7 +36,7 @@ WebDocumentLoader::WebDocumentLoader(const ResourceRequest& request, const Subst
     , m_detachedDataSource(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebDocumentLoader");
+    gClassNameCount().add("WebDocumentLoader");
 }
 
 PassRefPtr<WebDocumentLoader> WebDocumentLoader::create(const ResourceRequest& req, const SubstituteData& data)
@@ -47,7 +47,7 @@ PassRefPtr<WebDocumentLoader> WebDocumentLoader::create(const ResourceRequest& r
 WebDocumentLoader::~WebDocumentLoader()
 {
     gClassCount--;
-    gClassNameCount.remove("WebDocumentLoader");
+    gClassNameCount().remove("WebDocumentLoader");
     if (m_dataSource) {
         ASSERT(!m_detachedDataSource);
         m_dataSource->Release();
index d820cf5..2cb2d1d 100644 (file)
@@ -56,7 +56,7 @@ WebDownload::WebDownload()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebDownload");
+    gClassNameCount().add("WebDownload");
 }
 
 WebDownload::~WebDownload()
@@ -64,7 +64,7 @@ WebDownload::~WebDownload()
     LOG(Download, "WebDownload - Destroying download (%p)", this);
     cancel();
     gClassCount--;
-    gClassNameCount.remove("WebDownload");
+    gClassNameCount().remove("WebDownload");
 }
 
 WebDownload* WebDownload::createInstance()
index 8b3a0ed..d396575 100644 (file)
@@ -57,13 +57,13 @@ WebDropSource::WebDropSource(WebView* webView)
 , m_webView(webView)
 {
     gClassCount++;
-    gClassNameCount.add("WebDropSource");
+    gClassNameCount().add("WebDropSource");
 }
 
 WebDropSource::~WebDropSource()
 {
     gClassCount--;
-    gClassNameCount.remove("WebDropSource");
+    gClassNameCount().remove("WebDropSource");
 }
 
 STDMETHODIMP WebDropSource::QueryInterface(REFIID riid, void** ppvObject)
index 132ad93..34c6025 100644 (file)
@@ -48,13 +48,13 @@ WebElementPropertyBag::WebElementPropertyBag(const HitTestResult& result)
     , m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebElementPropertyBag");
+    gClassNameCount().add("WebElementPropertyBag");
 }
 
 WebElementPropertyBag::~WebElementPropertyBag()
 {
     gClassCount--;
-    gClassNameCount.remove("WebElementPropertyBag");
+    gClassNameCount().remove("WebElementPropertyBag");
 }
 
 WebElementPropertyBag* WebElementPropertyBag::createInstance(const HitTestResult& result)
index 920fff9..7b868a2 100644 (file)
@@ -44,13 +44,13 @@ WebError::WebError(const ResourceError& error, IPropertyBag* userInfo)
     , m_userInfo(userInfo)
 {
     gClassCount++;
-    gClassNameCount.add("WebError");
+    gClassNameCount().add("WebError");
 }
 
 WebError::~WebError()
 {
     gClassCount--;
-    gClassNameCount.remove("WebError");
+    gClassNameCount().remove("WebError");
 }
 
 WebError* WebError::createInstance(const ResourceError& error, IPropertyBag* userInfo)
index c57522a..ff1bfab 100644 (file)
@@ -253,7 +253,7 @@ WebFrame::WebFrame()
 {
     WebFrameCount++;
     gClassCount++;
-    gClassNameCount.add("WebFrame");
+    gClassNameCount().add("WebFrame");
 }
 
 WebFrame::~WebFrame()
@@ -261,7 +261,7 @@ WebFrame::~WebFrame()
     delete d;
     WebFrameCount--;
     gClassCount--;
-    gClassNameCount.remove("WebFrame");
+    gClassNameCount().remove("WebFrame");
 }
 
 WebFrame* WebFrame::createInstance()
index 194f0c8..05696f6 100644 (file)
@@ -41,13 +41,13 @@ WebFramePolicyListener::WebFramePolicyListener(PassRefPtr<Frame> frame)
     , m_frame(frame)
 {
     gClassCount++;
-    gClassNameCount.add("WebFramePolicyListener");
+    gClassNameCount().add("WebFramePolicyListener");
 }
 
 WebFramePolicyListener::~WebFramePolicyListener()
 {
     gClassCount--;
-    gClassNameCount.remove("WebFramePolicyListener");
+    gClassNameCount().remove("WebFramePolicyListener");
 }
 
 WebFramePolicyListener* WebFramePolicyListener::createInstance(PassRefPtr<Frame> frame)
index d16f892..98d17f7 100644 (file)
@@ -43,13 +43,13 @@ WebGeolocationPolicyListener::WebGeolocationPolicyListener(PassRefPtr<Geolocatio
     , m_geolocation(geolocation)
 {
     gClassCount++;
-    gClassNameCount.add("WebGeolocationPolicyListener");
+    gClassNameCount().add("WebGeolocationPolicyListener");
 }
 
 WebGeolocationPolicyListener::~WebGeolocationPolicyListener()
 {
     gClassCount--;
-    gClassNameCount.remove("WebGeolocationPolicyListener");
+    gClassNameCount().remove("WebGeolocationPolicyListener");
 }
 
 // IUnknown -------------------------------------------------------------------
index fb2ac6f..9e257d0 100644 (file)
@@ -40,13 +40,13 @@ WebGeolocationPosition::WebGeolocationPosition()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebGeolocationPosition");
+    gClassNameCount().add("WebGeolocationPosition");
 }
 
 WebGeolocationPosition::~WebGeolocationPosition()
 {
     gClassCount--;
-    gClassNameCount.remove("WebGeolocationPosition");
+    gClassNameCount().remove("WebGeolocationPosition");
 }
 
 HRESULT WebGeolocationPosition::QueryInterface(REFIID riid, void** ppvObject)
index 58d0fdc..2828926 100644 (file)
@@ -45,7 +45,7 @@ WebHTMLRepresentation::WebHTMLRepresentation()
 {
     WebHTMLRepresentationCount++;
     gClassCount++;
-    gClassNameCount.add("WebHTMLRepresentation");
+    gClassNameCount().add("WebHTMLRepresentation");
 }
 
 WebHTMLRepresentation::~WebHTMLRepresentation()
@@ -57,7 +57,7 @@ WebHTMLRepresentation::~WebHTMLRepresentation()
 
     WebHTMLRepresentationCount--;
     gClassCount--;
-    gClassNameCount.remove("WebHTMLRepresentation");
+    gClassNameCount().remove("WebHTMLRepresentation");
 }
 
 WebHTMLRepresentation* WebHTMLRepresentation::createInstance(WebFrame* frame)
index b9a46ac..faf0c2e 100644 (file)
@@ -158,7 +158,7 @@ WebHistory::WebHistory()
 , m_preferences(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebHistory");
+    gClassNameCount().add("WebHistory");
 
     m_preferences = WebPreferences::sharedStandardPreferences();
 }
@@ -166,7 +166,7 @@ WebHistory::WebHistory()
 WebHistory::~WebHistory()
 {
     gClassCount--;
-    gClassNameCount.remove("WebHistory");
+    gClassNameCount().remove("WebHistory");
 }
 
 WebHistory* WebHistory::createInstance()
index 3130a6c..43e7e90 100644 (file)
@@ -56,7 +56,7 @@ WebHistoryItem::WebHistoryItem(PassRefPtr<HistoryItem> historyItem)
     historyItemWrappers().set(m_historyItem.get(), this);
 
     gClassCount++;
-    gClassNameCount.add("WebHistoryItem");
+    gClassNameCount().add("WebHistoryItem");
 }
 
 WebHistoryItem::~WebHistoryItem()
@@ -65,7 +65,7 @@ WebHistoryItem::~WebHistoryItem()
     historyItemWrappers().remove(m_historyItem.get());
 
     gClassCount--;
-    gClassNameCount.remove("WebHistoryItem");
+    gClassNameCount().remove("WebHistoryItem");
 }
 
 WebHistoryItem* WebHistoryItem::createInstance()
index 5e13df9..3bc3bc0 100644 (file)
@@ -50,17 +50,17 @@ using namespace WTF;
 WebIconDatabase* WebIconDatabase::m_sharedWebIconDatabase = 0;
 
 WebIconDatabase::WebIconDatabase()
-: m_refCount(0)
-, m_deliveryRequested(false)
+    : m_refCount(0)
+    , m_deliveryRequested(false)
 {
     gClassCount++;
-    gClassNameCount.add("WebIconDatabase");
+    gClassNameCount().add("WebIconDatabase");
 }
 
 WebIconDatabase::~WebIconDatabase()
 {
     gClassCount--;
-    gClassNameCount.remove("WebIconDatabase");
+    gClassNameCount().remove("WebIconDatabase");
 }
 
 void WebIconDatabase::init()
index 7aedc0d..9030efa 100644 (file)
@@ -55,13 +55,13 @@ WebInspector::WebInspector(WebView* webView, WebInspectorClient* inspectorClient
     ASSERT_ARG(webView, webView);
 
     gClassCount++;
-    gClassNameCount.add("WebInspector");
+    gClassNameCount().add("WebInspector");
 }
 
 WebInspector::~WebInspector()
 {
     gClassCount--;
-    gClassNameCount.remove("WebInspector");
+    gClassNameCount().remove("WebInspector");
 }
 
 WebInspectorFrontendClient* WebInspector::frontendClient()
index d29bcac..9297b77 100644 (file)
@@ -42,13 +42,13 @@ WebJavaScriptCollector::WebJavaScriptCollector()
 : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebJavaScriptCollector");
+    gClassNameCount().add("WebJavaScriptCollector");
 }
 
 WebJavaScriptCollector::~WebJavaScriptCollector()
 {
     gClassCount--;
-    gClassNameCount.remove("WebJavaScriptCollector");
+    gClassNameCount().remove("WebJavaScriptCollector");
 }
 
 WebJavaScriptCollector* WebJavaScriptCollector::createInstance()
index fe3c188..52a5dda 100644 (file)
@@ -88,13 +88,13 @@ WebKitClassFactory::WebKitClassFactory(CLSID targetClass)
     WTF::initializeMainThread();
 
     gClassCount++;
-    gClassNameCount.add("WebKitClassFactory");
+    gClassNameCount().add("WebKitClassFactory");
 }
 
 WebKitClassFactory::~WebKitClassFactory()
 {
     gClassCount--;
-    gClassNameCount.remove("WebKitClassFactory");
+    gClassNameCount().remove("WebKitClassFactory");
 }
 
 // IUnknown -------------------------------------------------------------------
index 21c33fb..d8f98b6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007, 2014 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <WebCore/Widget.h>
 #include <olectl.h>
 #include <wchar.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/Vector.h>
 
 using namespace WebCore;
 
 ULONG gLockCount;
 ULONG gClassCount;
-HashCountedSet<String> gClassNameCount;
 HINSTANCE gInstance;
 
 #define CLSID_FOR_CLASS(cls) CLSID_##cls,
@@ -55,6 +55,13 @@ CLSID gRegCLSIDs[] = {
 };
 #undef CLSID_FOR_CLASS
 
+HashCountedSet<String>& gClassNameCount()
+{
+    static NeverDestroyed<HashCountedSet<String>> gClassNameCount;
+    return gClassNameCount.get();
+}
+
+
 STDAPI_(BOOL) DllMain( HMODULE hModule, DWORD  ul_reason_for_call, LPVOID /*lpReserved*/)
 {
     switch (ul_reason_for_call) {
index 11128ca..d35b326 100644 (file)
@@ -48,7 +48,7 @@ extern "C" {
 
 extern ULONG gLockCount;
 extern ULONG gClassCount;
-extern HashCountedSet<WTF::String> gClassNameCount;
+extern HashCountedSet<WTF::String>& gClassNameCount();
 extern HINSTANCE gInstance;
 extern CLSID gRegCLSIDs[];
 
index bb09601..bc3219d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007, 2014 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,16 +45,16 @@ int WebFrameViewCount;
 // WebKitStatistics ---------------------------------------------------------------------------
 
 WebKitStatistics::WebKitStatistics()
-: m_refCount(0)
+    : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebKitStatistics");
+    gClassNameCount().add("WebKitStatistics");
 }
 
 WebKitStatistics::~WebKitStatistics()
 {
     gClassCount--;
-    gClassNameCount.remove("WebKitStatistics");
+    gClassNameCount().remove("WebKitStatistics");
 }
 
 WebKitStatistics* WebKitStatistics::createInstance()
@@ -138,11 +138,10 @@ HRESULT STDMETHODCALLTYPE WebKitStatistics::comClassCount(
     return S_OK;
 }
 
-HRESULT STDMETHODCALLTYPE WebKitStatistics::comClassNameCounts( 
-    /* [retval][out] */ BSTR *output)
+HRESULT WebKitStatistics::comClassNameCounts(BSTR* output)
 {
     StringBuilder builder;
-    for (auto& slot : gClassNameCount) {
+    for (auto& slot : gClassNameCount()) {
         builder.appendNumber(slot.value);
         builder.append('\t');
         builder.append(slot.key);
index f999ac8..a3680e1 100644 (file)
@@ -54,7 +54,7 @@ WebMutableURLRequest::WebMutableURLRequest(bool isMutable)
     , m_isMutable(isMutable)
 {
     gClassCount++;
-    gClassNameCount.add("WebMutableURLRequest");
+    gClassNameCount().add("WebMutableURLRequest");
 }
 
 WebMutableURLRequest* WebMutableURLRequest::createInstance()
@@ -98,7 +98,7 @@ WebMutableURLRequest* WebMutableURLRequest::createImmutableInstance(const Resour
 WebMutableURLRequest::~WebMutableURLRequest()
 {
     gClassCount--;
-    gClassNameCount.remove("WebMutableURLRequest");
+    gClassNameCount().remove("WebMutableURLRequest");
 }
 
 // IUnknown -------------------------------------------------------------------
index 762e2bc..a3982a2 100644 (file)
@@ -72,13 +72,13 @@ WebNavigationData::WebNavigationData(const String& url, const String& title, IWe
 
 {
     gClassCount++;
-    gClassNameCount.add("WebNavigationData");
+    gClassNameCount().add("WebNavigationData");
 }
 
 WebNavigationData::~WebNavigationData()
 {
     gClassCount--;
-    gClassNameCount.remove("WebNavigationData");
+    gClassNameCount().remove("WebNavigationData");
 }
 
 WebNavigationData* WebNavigationData::createInstance(const String& url, const String& title, IWebURLRequest* request, IWebURLResponse* response, bool hasSubstituteData, const String& clientRedirectSource)
index d7a67d3..585f238 100644 (file)
@@ -46,7 +46,7 @@ WebNotification::WebNotification(BSTR name, IUnknown* anObject, IPropertyBag* us
         m_userInfo->AddRef();
 
     gClassCount++;
-    gClassNameCount.add("WebNotification");
+    gClassNameCount().add("WebNotification");
 }
 
 WebNotification::~WebNotification()
@@ -59,7 +59,7 @@ WebNotification::~WebNotification()
         m_userInfo->Release();
 
     gClassCount--;
-    gClassNameCount.remove("WebNotification");
+    gClassNameCount().remove("WebNotification");
 }
 
 WebNotification* WebNotification::createInstance(BSTR name /*=0*/, IUnknown* anObject /*=0*/, IPropertyBag* userInfo /*=0*/)
index 4a78653..588c855 100644 (file)
@@ -59,13 +59,13 @@ WebNotificationCenter::WebNotificationCenter()
     , d(adoptPtr(new WebNotificationCenterPrivate))
 {
     gClassCount++;
-    gClassNameCount.add("WebNotificationCenter");
+    gClassNameCount().add("WebNotificationCenter");
 }
 
 WebNotificationCenter::~WebNotificationCenter()
 {
     gClassCount--;
-    gClassNameCount.remove("WebNotificationCenter");
+    gClassNameCount().remove("WebNotificationCenter");
 }
 
 WebNotificationCenter* WebNotificationCenter::createInstance()
index 8467d61..ab93cc2 100644 (file)
@@ -40,6 +40,7 @@
 #include <shlobj.h>
 #include <wchar.h>
 #include <wtf/HashMap.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringHash.h>
@@ -101,7 +102,11 @@ static bool booleanValueForPreferencesValue(CFPropertyListRef value)
 
 static CFDictionaryRef defaultSettings;
 
-static HashMap<WTF::String, COMPtr<WebPreferences> > webPreferencesInstances;
+static HashMap<WTF::String, COMPtr<WebPreferences>>& webPreferencesInstances()
+{
+    static NeverDestroyed<HashMap<WTF::String, COMPtr<WebPreferences>>> webPreferencesInstances;
+    return webPreferencesInstances;
+}
 
 WebPreferences* WebPreferences::sharedStandardPreferences()
 {
@@ -122,13 +127,13 @@ WebPreferences::WebPreferences()
     , m_numWebViews(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebPreferences");
+    gClassNameCount().add("WebPreferences");
 }
 
 WebPreferences::~WebPreferences()
 {
     gClassCount--;
-    gClassNameCount.remove("WebPreferences");
+    gClassNameCount().remove("WebPreferences");
 }
 
 WebPreferences* WebPreferences::createInstance()
@@ -157,7 +162,7 @@ WebPreferences* WebPreferences::getInstanceForIdentifier(BSTR identifier)
     if (identifierString.isEmpty())
         return sharedStandardPreferences();
 
-    return webPreferencesInstances.get(identifierString).get();
+    return webPreferencesInstances().get(identifierString).get();
 }
 
 void WebPreferences::setInstance(WebPreferences* instance, BSTR identifier)
@@ -167,20 +172,20 @@ void WebPreferences::setInstance(WebPreferences* instance, BSTR identifier)
     WTF::String identifierString(identifier, SysStringLen(identifier));
     if (identifierString.isEmpty())
         return;
-    webPreferencesInstances.add(identifierString, instance);
+    webPreferencesInstances().add(identifierString, instance);
 }
 
 void WebPreferences::removeReferenceForIdentifier(BSTR identifier)
 {
-    if (!identifier || webPreferencesInstances.isEmpty())
+    if (!identifier || webPreferencesInstances().isEmpty())
         return;
 
     WTF::String identifierString(identifier, SysStringLen(identifier));
     if (identifierString.isEmpty())
         return;
-    WebPreferences* webPreference = webPreferencesInstances.get(identifierString).get();
+    WebPreferences* webPreference = webPreferencesInstances().get(identifierString).get();
     if (webPreference && webPreference->m_refCount == 1)
-        webPreferencesInstances.remove(identifierString);
+        webPreferencesInstances().remove(identifierString);
 }
 
 void WebPreferences::initializeDefaultSettings()
index bdbe016..819938a 100644 (file)
@@ -44,13 +44,13 @@ WebResource::WebResource(IStream* data, const WebCore::URL& url, const WTF::Stri
     , m_frameName(frameName)
 {
     gClassCount++;
-    gClassNameCount.add("WebResource");
+    gClassNameCount().add("WebResource");
 }
 
 WebResource::~WebResource()
 {
     gClassCount--;
-    gClassNameCount.remove("WebResource");
+    gClassNameCount().remove("WebResource");
 }
 
 WebResource* WebResource::createInstance(PassRefPtr<WebCore::SharedBuffer> data, const WebCore::ResourceResponse& response)
index 10b1919..e0590e5 100644 (file)
 // WebScriptObject ------------------------------------------------------------
 
 WebScriptObject::WebScriptObject()
-: m_refCount(0)
+    : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebScriptObject");
+    gClassNameCount().add("WebScriptObject");
 }
 
 WebScriptObject::~WebScriptObject()
 {
     gClassCount--;
-    gClassNameCount.remove("WebScriptObject");
+    gClassNameCount().remove("WebScriptObject");
 }
 
 // IUnknown -------------------------------------------------------------------
index 87c62b0..5da05cd 100644 (file)
@@ -49,7 +49,7 @@ inline WebScriptWorld::WebScriptWorld(PassRefPtr<DOMWrapperWorld> world)
     allWorlds().add(m_world.get(), this);
 
     ++gClassCount;
-    gClassNameCount.add("WebScriptWorld");
+    gClassNameCount().add("WebScriptWorld");
 }
 
 WebScriptWorld::~WebScriptWorld()
@@ -58,7 +58,7 @@ WebScriptWorld::~WebScriptWorld()
     allWorlds().remove(m_world.get());
 
     --gClassCount;
-    gClassNameCount.remove("WebScriptWorld");
+    gClassNameCount().remove("WebScriptWorld");
 }
 
 WebScriptWorld* WebScriptWorld::standardWorld()
index 5665ca9..28ec979 100644 (file)
@@ -48,13 +48,13 @@ WebSecurityOrigin::WebSecurityOrigin(SecurityOrigin* securityOrigin)
     , m_securityOrigin(securityOrigin)
 {
     gClassCount++;
-    gClassNameCount.add("WebSecurityOrigin");
+    gClassNameCount().add("WebSecurityOrigin");
 }
 
 WebSecurityOrigin::~WebSecurityOrigin()
 {
     gClassCount--;
-    gClassNameCount.remove("WebSecurityOrigin");
+    gClassNameCount().remove("WebSecurityOrigin");
 }
 
 // IUnknown ------------------------------------------------------------------------
index 7f6e3b0..68e235b 100644 (file)
@@ -34,13 +34,13 @@ WebSerializedJSValue::WebSerializedJSValue()
     : m_refCount(0)
 {
     ++gClassCount;
-    gClassNameCount.add("WebSerializedJSValue");
+    gClassNameCount().add("WebSerializedJSValue");
 }
 
 WebSerializedJSValue::~WebSerializedJSValue()
 {
     --gClassCount;
-    gClassNameCount.remove("WebSerializedJSValue");
+    gClassNameCount().remove("WebSerializedJSValue");
 }
 
 COMPtr<WebSerializedJSValue> WebSerializedJSValue::createInstance()
index 2fc4d2a..dfe090c 100644 (file)
@@ -42,13 +42,13 @@ WebTextRenderer::WebTextRenderer()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebTextRenderer");
+    gClassNameCount().add("WebTextRenderer");
 }
 
 WebTextRenderer::~WebTextRenderer()
 {
     gClassCount--;
-    gClassNameCount.remove("WebTextRenderer");
+    gClassNameCount().remove("WebTextRenderer");
 }
 
 HRESULT STDMETHODCALLTYPE WebTextRenderer::QueryInterface(const IID &riid, void** ppvObject)
index 4ea1b5a..3580cf3 100644 (file)
@@ -49,13 +49,13 @@ WebURLAuthenticationChallenge::WebURLAuthenticationChallenge(const Authenticatio
     , m_sender(sender)
 {
     gClassCount++;
-    gClassNameCount.add("WebURLAuthenticationChallenge");
+    gClassNameCount().add("WebURLAuthenticationChallenge");
 }
 
 WebURLAuthenticationChallenge::~WebURLAuthenticationChallenge()
 {
     gClassCount--;
-    gClassNameCount.remove("WebURLAuthenticationChallenge");
+    gClassNameCount().remove("WebURLAuthenticationChallenge");
 }
 
 WebURLAuthenticationChallenge* WebURLAuthenticationChallenge::createInstance(const AuthenticationChallenge& authenticationChallenge)
index d05e550..c7a35fa 100644 (file)
@@ -44,13 +44,13 @@ WebURLAuthenticationChallengeSender::WebURLAuthenticationChallengeSender(PassRef
 {
     ASSERT(m_client);
     gClassCount++;
-    gClassNameCount.add("WebURLAuthenticationChallengeSender");
+    gClassNameCount().add("WebURLAuthenticationChallengeSender");
 }
 
 WebURLAuthenticationChallengeSender::~WebURLAuthenticationChallengeSender()
 {
     gClassCount--;
-    gClassNameCount.remove("WebURLAuthenticationChallengeSender");
+    gClassNameCount().remove("WebURLAuthenticationChallengeSender");
 }
 
 WebURLAuthenticationChallengeSender* WebURLAuthenticationChallengeSender::createInstance(PassRefPtr<WebCore::AuthenticationClient> client)
index 955c82f..64bf707 100644 (file)
@@ -39,13 +39,13 @@ WebURLCredential::WebURLCredential(const Credential& credential)
     , m_credential(credential)
 {
     gClassCount++;
-    gClassNameCount.add("WebURLCredential");
+    gClassNameCount().add("WebURLCredential");
 }
 
 WebURLCredential::~WebURLCredential()
 {
     gClassCount--;
-    gClassNameCount.remove("WebURLCredential");
+    gClassNameCount().remove("WebURLCredential");
 }
 
 WebURLCredential* WebURLCredential::createInstance()
index 653c259..ee23220 100644 (file)
@@ -39,13 +39,13 @@ WebURLProtectionSpace::WebURLProtectionSpace(const ProtectionSpace& protectionSp
     , m_protectionSpace(protectionSpace)
 {
     gClassCount++;
-    gClassNameCount.add("WebURLProtectionSpace");
+    gClassNameCount().add("WebURLProtectionSpace");
 }
 
 WebURLProtectionSpace::~WebURLProtectionSpace()
 {
     gClassCount--;
-    gClassNameCount.remove("WebURLProtectionSpace");
+    gClassNameCount().remove("WebURLProtectionSpace");
 }
 
 WebURLProtectionSpace* WebURLProtectionSpace::createInstance()
index e7c1e53..d7a2c48 100644 (file)
@@ -212,13 +212,13 @@ WebURLResponse::WebURLResponse()
     :m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebURLResponse");
+    gClassNameCount().add("WebURLResponse");
 }
 
 WebURLResponse::~WebURLResponse()
 {
     gClassCount--;
-    gClassNameCount.remove("WebURLResponse");
+    gClassNameCount().remove("WebURLResponse");
 }
 
 WebURLResponse* WebURLResponse::createInstance()
index 079c402..3e5f28d 100644 (file)
@@ -37,13 +37,13 @@ inline WebUserContentURLPattern::WebUserContentURLPattern()
     : m_refCount(0)
 {
     ++gClassCount;
-    gClassNameCount.add("WebUserContentURLPattern");
+    gClassNameCount().add("WebUserContentURLPattern");
 }
 
 WebUserContentURLPattern::~WebUserContentURLPattern()
 {
     --gClassCount;
-    gClassNameCount.remove("WebUserContentURLPattern");
+    gClassNameCount().remove("WebUserContentURLPattern");
 }
 
 COMPtr<WebUserContentURLPattern> WebUserContentURLPattern::createInstance()
index e3dc6c1..b0074f0 100644 (file)
@@ -202,7 +202,11 @@ using namespace std;
 using JSC::JSLock;
 
 static HMODULE accessibilityLib;
-static HashSet<WebView*> pendingDeleteBackingStoreSet;
+static HashSet<WebView*>& pendingDeleteBackingStoreSet()
+{
+    static NeverDestroyed<HashSet<WebView*>> pendingDeleteBackingStoreSet;
+    return pendingDeleteBackingStoreSet;
+}
 
 static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache");
 
@@ -424,7 +428,7 @@ WebView::WebView()
 
     WebViewCount++;
     gClassCount++;
-    gClassNameCount.add("WebView");
+    gClassNameCount().add("WebView");
 }
 
 WebView::~WebView()
@@ -445,7 +449,7 @@ WebView::~WebView()
 
     WebViewCount--;
     gClassCount--;
-    gClassNameCount.remove("WebView");
+    gClassNameCount().remove("WebView");
 }
 
 WebView* WebView::createInstance()
@@ -815,7 +819,7 @@ void WebView::repaint(const WebCore::IntRect& windowRect, bool contentChanged, b
 
 void WebView::deleteBackingStore()
 {
-    pendingDeleteBackingStoreSet.remove(this);
+    pendingDeleteBackingStoreSet().remove(this);
 
     if (m_deleteBackingStoreTimerActive) {
         KillTimer(m_viewWindow, DeleteBackingStoreTimer);
@@ -3435,17 +3439,17 @@ void WebView::updateActiveStateSoon() const
 
 void WebView::deleteBackingStoreSoon()
 {
-    if (pendingDeleteBackingStoreSet.size() > 2) {
+    if (pendingDeleteBackingStoreSet().size() > 2) {
         Vector<WebView*> views;
-        HashSet<WebView*>::iterator end = pendingDeleteBackingStoreSet.end();
-        for (HashSet<WebView*>::iterator it = pendingDeleteBackingStoreSet.begin(); it != end; ++it)
+        HashSet<WebView*>::iterator end = pendingDeleteBackingStoreSet().end();
+        for (HashSet<WebView*>::iterator it = pendingDeleteBackingStoreSet().begin(); it != end; ++it)
             views.append(*it);
         for (int i = 0; i < views.size(); ++i)
             views[i]->deleteBackingStore();
-        ASSERT(pendingDeleteBackingStoreSet.isEmpty());
+        ASSERT(pendingDeleteBackingStoreSet().isEmpty());
     }
 
-    pendingDeleteBackingStoreSet.add(this);
+    pendingDeleteBackingStoreSet().add(this);
     m_deleteBackingStoreTimerActive = true;
     SetTimer(m_viewWindow, DeleteBackingStoreTimer, delayBeforeDeletingBackingStoreMsec, 0);
 }
@@ -3454,7 +3458,7 @@ void WebView::cancelDeleteBackingStoreSoon()
 {
     if (!m_deleteBackingStoreTimerActive)
         return;
-    pendingDeleteBackingStoreSet.remove(this);
+    pendingDeleteBackingStoreSet().remove(this);
     m_deleteBackingStoreTimerActive = false;
     KillTimer(m_viewWindow, DeleteBackingStoreTimer);
 }
index 3326926..93855bd 100644 (file)
@@ -90,11 +90,11 @@ WebWorkersPrivate::WebWorkersPrivate()
     : m_refCount(0)
 {
     gClassCount++;
-    gClassNameCount.add("WebWorkersPrivate");
+    gClassNameCount().add("WebWorkersPrivate");
 }
 
 WebWorkersPrivate::~WebWorkersPrivate()
 {
     gClassCount--;
-    gClassNameCount.remove("WebWorkersPrivate");
+    gClassNameCount().remove("WebWorkersPrivate");
 }