Reviewed by Darin Adler.
authorbolsinga@apple.com <bolsinga@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Nov 2008 04:47:20 +0000 (04:47 +0000)
committerbolsinga@apple.com <bolsinga@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Nov 2008 04:47:20 +0000 (04:47 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=21810
        Remove use of static C++ objects that are destroyed at exit time (destructors)

        Create DEFINE_STATIC_LOCAL macro. Change static local objects to leak to avoid
        exit-time destructor. Update code that was changed to fix this issue that ran
        into a gcc bug (<rdar://problem/6354696> Codegen issue with C++ static reference
        in gcc build 5465). Also typdefs for template types needed to be added in some
        cases so the type could make it through the macro successfully.

        Basically code of the form:
        static T m;
        becomes:
        DEFINE_STATIC_LOCAL(T, m, ());

        Also any code of the form:
        static T& m = *new T;
        also becomes:
        DEFINE_STATIC_LOCAL(T, m, ());

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

81 files changed:
WebCore/ChangeLog
WebCore/ForwardingHeaders/wtf/StdLibExtras.h [new file with mode: 0644]
WebCore/bindings/js/GCController.cpp
WebCore/bindings/js/JSDOMBinding.cpp
WebCore/bindings/js/JSInspectedObjectWrapper.cpp
WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
WebCore/bindings/js/JSNavigatorCustom.cpp
WebCore/bridge/runtime_root.cpp
WebCore/css/CSSMutableStyleDeclaration.cpp
WebCore/css/CSSPrimitiveValue.cpp
WebCore/css/CSSSelector.cpp
WebCore/css/CSSStyleSelector.cpp
WebCore/dom/DOMImplementation.cpp
WebCore/dom/Document.cpp
WebCore/dom/ScriptElement.cpp
WebCore/editing/ApplyStyleCommand.cpp
WebCore/editing/HTMLInterchange.cpp
WebCore/editing/IndentOutdentCommand.cpp
WebCore/editing/ReplaceSelectionCommand.cpp
WebCore/editing/htmlediting.cpp
WebCore/editing/markup.cpp
WebCore/html/HTMLButtonElement.cpp
WebCore/html/HTMLElement.cpp
WebCore/html/HTMLFieldSetElement.cpp
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLKeygenElement.cpp
WebCore/html/HTMLLegendElement.cpp
WebCore/html/HTMLOptGroupElement.cpp
WebCore/html/HTMLOptionElement.cpp
WebCore/html/HTMLParser.cpp
WebCore/html/HTMLSelectElement.cpp
WebCore/html/HTMLTextAreaElement.cpp
WebCore/inspector/InspectorController.cpp
WebCore/inspector/JavaScriptDebugServer.cpp
WebCore/inspector/JavaScriptProfile.cpp
WebCore/inspector/JavaScriptProfileNode.cpp
WebCore/loader/FrameLoader.cpp
WebCore/loader/appcache/ApplicationCacheStorage.cpp
WebCore/loader/archive/ArchiveFactory.cpp
WebCore/loader/icon/IconDatabase.cpp
WebCore/page/EventHandler.cpp
WebCore/page/Frame.cpp
WebCore/page/Page.cpp
WebCore/page/SecurityOrigin.cpp
WebCore/page/mac/FrameMac.mm
WebCore/platform/KURL.cpp
WebCore/platform/graphics/FontCache.cpp
WebCore/platform/graphics/mac/FontCacheMac.mm
WebCore/platform/mac/CursorMac.mm
WebCore/platform/mac/ScrollbarThemeMac.mm
WebCore/platform/mac/ThemeMac.mm
WebCore/platform/mac/ThreadCheck.mm
WebCore/platform/network/NetworkStateNotifier.cpp
WebCore/platform/network/mac/FormDataStreamMac.mm
WebCore/platform/network/mac/ResourceResponseMac.mm
WebCore/platform/text/TextEncoding.cpp
WebCore/plugins/PluginMainThreadScheduler.cpp
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderCounter.cpp
WebCore/rendering/RenderFlexibleBox.cpp
WebCore/rendering/RenderListItem.cpp
WebCore/rendering/RenderScrollbarTheme.cpp
WebCore/rendering/RenderThemeMac.mm
WebCore/rendering/bidi.cpp
WebCore/rendering/style/RenderStyle.cpp
WebCore/storage/Database.cpp
WebCore/storage/DatabaseTracker.cpp
WebCore/storage/LocalStorage.cpp
WebCore/svg/SVGAnimateMotionElement.cpp
WebCore/svg/SVGAnimationElement.cpp
WebCore/svg/SVGLangSpace.cpp
WebCore/svg/SVGSVGElement.cpp
WebCore/svg/SVGStyleElement.cpp
WebCore/svg/SVGTextContentElement.cpp
WebCore/svg/animation/SVGSMILElement.cpp
WebCore/svg/graphics/SVGResource.cpp
WebCore/svg/graphics/SVGResourceMarker.cpp
WebCore/xml/XMLHttpRequest.cpp
WebCore/xml/XPathExpressionNode.cpp
WebCore/xml/XPathParser.cpp
WebCore/xml/XPathValue.cpp

index b9d0bb1..c1655ca 100644 (file)
@@ -1,3 +1,271 @@
+2008-11-14  Greg Bolsinga  <bolsinga@apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=21810
+        Remove use of static C++ objects that are destroyed at exit time (destructors)
+
+        Create DEFINE_STATIC_LOCAL macro. Change static local objects to leak to avoid 
+        exit-time destructor. Update code that was changed to fix this issue that ran 
+        into a gcc bug (<rdar://problem/6354696> Codegen issue with C++ static reference 
+        in gcc build 5465). Also typdefs for template types needed to be added in some 
+        cases so the type could make it through the macro successfully.
+
+        Basically code of the form:
+        static T m;
+        becomes:
+        DEFINE_STATIC_LOCAL(T, m, ());
+
+        Also any code of the form:
+        static T& m = *new T;
+        also becomes:
+        DEFINE_STATIC_LOCAL(T, m, ());
+
+        * ForwardingHeaders/wtf/StdLibExtras.h: Added.
+        * bindings/js/GCController.cpp:
+        (WebCore::gcController):
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::wrapperSet):
+        * bindings/js/JSInspectedObjectWrapper.cpp:
+        (WebCore::wrappers):
+        * bindings/js/JSInspectorCallbackWrapper.cpp:
+        (WebCore::wrappers):
+        * bindings/js/JSNavigatorCustom.cpp:
+        (WebCore::needsYouTubeQuirk):
+        * bridge/runtime_root.cpp:
+        (JSC::Bindings::rootObjectSet):
+        * css/CSSMutableStyleDeclaration.cpp:
+        (WebCore::initShorthandMap):
+        (WebCore::CSSMutableStyleDeclaration::removeProperty):
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::cssText):
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::extractPseudoType):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::screenEval):
+        (WebCore::printEval):
+        * dom/DOMImplementation.cpp:
+        (WebCore::addString):
+        (WebCore::isSVG10Feature):
+        (WebCore::isSVG11Feature):
+        (WebCore::DOMImplementation::isXMLMIMEType):
+        * dom/Document.cpp:
+        (WebCore::Document::hasPrefixNamespaceMismatch):
+        * dom/ScriptElement.cpp:
+        (WebCore::isSupportedJavaScriptLanguage):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::styleSpanClassString):
+        * editing/HTMLInterchange.cpp:
+        (WebCore::):
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::indentBlockquoteString):
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::isInterchangeNewlineNode):
+        (WebCore::isInterchangeConvertedSpaceSpan):
+        * editing/htmlediting.cpp:
+        (WebCore::stringWithRebalancedWhitespace):
+        (WebCore::nonBreakingSpaceString):
+        * editing/markup.cpp:
+        (WebCore::appendAttributeValue):
+        (WebCore::appendEscapedContent):
+        (WebCore::shouldAddNamespaceAttr):
+        (WebCore::appendNamespace):
+        (WebCore::appendStartMarkup):
+        (WebCore::createMarkup):
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::type):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::isRecognizedTagName):
+        (WebCore::inlineTagList):
+        (WebCore::blockTagList):
+        * html/HTMLFieldSetElement.cpp:
+        (WebCore::HTMLFieldSetElement::type):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::type):
+        * html/HTMLKeygenElement.cpp:
+        (WebCore::HTMLKeygenElement::type):
+        * html/HTMLLegendElement.cpp:
+        (WebCore::HTMLLegendElement::type):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::type):
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::type):
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::getNode):
+        (WebCore::HTMLParser::isHeaderTag):
+        (WebCore::HTMLParser::isResidualStyleTag):
+        (WebCore::HTMLParser::isAffectedByResidualStyle):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::type):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::type):
+        * inspector/InspectorController.cpp:
+        (WebCore::platform):
+        * inspector/JavaScriptDebugServer.cpp:
+        (WebCore::JavaScriptDebugServer::shared):
+        * inspector/JavaScriptProfile.cpp:
+        (WebCore::profileCache):
+        * inspector/JavaScriptProfileNode.cpp:
+        (WebCore::profileNodeCache):
+        * loader/FrameLoader.cpp:
+        (WebCore::localSchemes):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::cacheStorage):
+        * loader/archive/ArchiveFactory.cpp:
+        (WebCore::archiveMIMETypes):
+        (WebCore::ArchiveFactory::registerKnownArchiveMIMETypes):
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::IconDatabase::defaultDatabaseFilename):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dragState):
+        * page/Frame.cpp:
+        (WebCore::createRegExpForLabels):
+        (WebCore::keepAliveSet):
+        * page/Page.cpp:
+        (WebCore::Page::groupName):
+        * page/SecurityOrigin.cpp:
+        (WebCore::isDefaultPortForProtocol):
+        (WebCore::SecurityOrigin::databaseIdentifier):
+        * page/mac/FrameMac.mm:
+        (WebCore::regExpForLabels):
+        * platform/KURL.cpp:
+        (WebCore::blankURL):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::alternateFamilyName):
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::getSimilarFontPlatformData):
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/mac/CursorMac.mm:
+        (WebCore::leakNamedCursor):
+        (WebCore::pointerCursor):
+        (WebCore::crossCursor):
+        (WebCore::handCursor):
+        (WebCore::moveCursor):
+        (WebCore::verticalTextCursor):
+        (WebCore::cellCursor):
+        (WebCore::contextMenuCursor):
+        (WebCore::aliasCursor):
+        (WebCore::zoomInCursor):
+        (WebCore::zoomOutCursor):
+        (WebCore::copyCursor):
+        (WebCore::noneCursor):
+        (WebCore::progressCursor):
+        (WebCore::noDropCursor):
+        (WebCore::notAllowedCursor):
+        (WebCore::iBeamCursor):
+        (WebCore::waitCursor):
+        (WebCore::helpCursor):
+        (WebCore::eastResizeCursor):
+        (WebCore::northResizeCursor):
+        (WebCore::northEastResizeCursor):
+        (WebCore::northWestResizeCursor):
+        (WebCore::southResizeCursor):
+        (WebCore::southEastResizeCursor):
+        (WebCore::southWestResizeCursor):
+        (WebCore::westResizeCursor):
+        (WebCore::northSouthResizeCursor):
+        (WebCore::eastWestResizeCursor):
+        (WebCore::northEastSouthWestResizeCursor):
+        (WebCore::northWestSouthEastResizeCursor):
+        (WebCore::columnResizeCursor):
+        (WebCore::rowResizeCursor):
+        (WebCore::grabCursor):
+        (WebCore::grabbingCursor):
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::ScrollbarTheme::nativeTheme):
+        * platform/mac/ThemeMac.mm:
+        (WebCore::platformTheme):
+        * platform/mac/ThreadCheck.mm:
+        (WebCoreReportThreadViolation):
+        * platform/network/NetworkStateNotifier.cpp:
+        (WebCore::networkStateNotifier):
+        * platform/network/mac/FormDataStreamMac.mm:
+        (WebCore::getStreamFormDataMap):
+        (WebCore::getStreamResourceHandleMap):
+        * platform/network/mac/ResourceResponseMac.mm:
+        (WebCore::ResourceResponse::platformLazyInit):
+        * platform/text/TextEncoding.cpp:
+        (WebCore::TextEncoding::isJapanese):
+        * plugins/PluginMainThreadScheduler.cpp:
+        (WebCore::PluginMainThreadScheduler::scheduler):
+        * rendering/RenderBlock.cpp:
+        (WebCore::continuationOutlineTable):
+        (WebCore::RenderBlock::addContinuationWithOutline):
+        (WebCore::RenderBlock::paintContinuationOutlines):
+        * rendering/RenderCounter.cpp:
+        (WebCore::counterMaps):
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutVerticalBox):
+        * rendering/RenderListItem.cpp:
+        (WebCore::RenderListItem::markerText):
+        * rendering/RenderScrollbarTheme.cpp:
+        (WebCore::RenderScrollbarTheme::renderScrollbarTheme):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::systemFont):
+        * rendering/bidi.cpp:
+        (WebCore::RenderBlock::checkLinesForTextOverflow):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::initialDashboardRegions):
+        (WebCore::RenderStyle::noneDashboardRegions):
+        * storage/Database.cpp:
+        (WebCore::guidMutex):
+        (WebCore::guidToVersionMap):
+        (WebCore::guidToDatabaseMap):
+        (WebCore::Database::databaseInfoTableName):
+        (WebCore::databaseVersionKey):
+        (WebCore::Database::getVersionFromDatabase):
+        (WebCore::Database::setVersionInDatabase):
+        (WebCore::guidForOriginAndName):
+        * storage/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::tracker):
+        (WebCore::notificationMutex):
+        (WebCore::notificationQueue):
+        * storage/LocalStorage.cpp:
+        (WebCore::localStorageMap):
+        * svg/SVGAnimateMotionElement.cpp:
+        (WebCore::SVGAnimateMotionElement::rotateMode):
+        * svg/SVGAnimationElement.cpp:
+        (WebCore::SVGAnimationElement::calcMode):
+        (WebCore::SVGAnimationElement::attributeType):
+        (WebCore::SVGAnimationElement::isAdditive):
+        (WebCore::SVGAnimationElement::isAccumulated):
+        * svg/SVGLangSpace.cpp:
+        (WebCore::SVGLangSpace::xmlspace):
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::contentScriptType):
+        (WebCore::SVGSVGElement::contentStyleType):
+        * svg/SVGStyleElement.cpp:
+        (WebCore::SVGStyleElement::type):
+        (WebCore::SVGStyleElement::media):
+        * svg/SVGTextContentElement.cpp:
+        (WebCore::SVGTextContentElement::parseMappedAttribute):
+        * svg/animation/SVGSMILElement.cpp:
+        (WebCore::SVGSMILElement::parseClockValue):
+        (WebCore::SVGSMILElement::restart):
+        (WebCore::SVGSMILElement::fill):
+        (WebCore::SVGSMILElement::repeatCount):
+        (WebCore::SVGSMILElement::notifyDependentsIntervalChanged):
+        * svg/graphics/SVGResource.cpp:
+        (WebCore::clientMap):
+        (WebCore::SVGResource::removeClient):
+        * svg/graphics/SVGResourceMarker.cpp:
+        (WebCore::SVGResourceMarker::draw):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::PreflightResultCacheItem::PreflightResultCacheItem):
+        (WebCore::preflightResultCache):
+        (WebCore::appendPreflightResultCacheEntry):
+        (WebCore::isSafeRequestHeader):
+        (WebCore::isOnAccessControlResponseHeaderWhitelist):
+        (WebCore::XMLHttpRequest::didReceiveResponsePreflight):
+        * xml/XPathExpressionNode.cpp:
+        (WebCore::XPath::Expression::evaluationContext):
+        * xml/XPathParser.cpp:
+        (WebCore::XPath::setUpAxisNamesMap):
+        (WebCore::XPath::isAxisName):
+        (WebCore::XPath::isNodeTypeName):
+        * xml/XPathValue.cpp:
+        (WebCore::XPath::Value::toNodeSet):
+
 2008-11-14  Dan Bernstein  <mitz@apple.com>
 
         - attempt to fix the Qt build
diff --git a/WebCore/ForwardingHeaders/wtf/StdLibExtras.h b/WebCore/ForwardingHeaders/wtf/StdLibExtras.h
new file mode 100644 (file)
index 0000000..3222ec1
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/StdLibExtras.h>
index 7a3f20d..ceb7928 100644 (file)
@@ -30,6 +30,7 @@
 #include <runtime/JSGlobalData.h>
 #include <runtime/JSLock.h>
 #include <runtime/Collector.h>
+#include <wtf/StdLibExtras.h>
 
 #if USE(PTHREADS)
 #include <pthread.h>
@@ -52,7 +53,7 @@ static void* collect(void*)
 
 GCController& gcController()
 {
-    static GCController staticGCController;
+    DEFINE_STATIC_LOCAL(GCController, staticGCController, ());
     return staticGCController;
 }
 
index b2c4cd5..f90f6ed 100644 (file)
@@ -46,6 +46,7 @@
 #include "ScriptController.h"
 #include "XMLHttpRequestException.h"
 #include <runtime/PrototypeFunction.h>
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(SVG)
 #include "JSSVGException.h"
@@ -97,10 +98,10 @@ static inline void removeWrappers(const JSWrapperCache&)
 static HashSet<DOMObject*>& wrapperSet()
 {
 #if ENABLE(WORKERS)
-    static ThreadSpecific<HashSet<DOMObject*> > staticWrapperSet;
+    DEFINE_STATIC_LOCAL(ThreadSpecific<HashSet<DOMObject*> >, staticWrapperSet, ());
     return *staticWrapperSet;
 #else
-    static HashSet<DOMObject*> staticWrapperSet;
+    DEFINE_STATIC_LOCAL(HashSet<DOMObject*>, staticWrapperSet, ());
     return staticWrapperSet;
 #endif
 }
index 9bc7e7d..fbc76c0 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "JSInspectorCallbackWrapper.h"
 #include <runtime/JSGlobalObject.h>
+#include <wtf/StdLibExtras.h>
 
 using namespace JSC;
 
@@ -40,7 +41,7 @@ typedef HashMap<JSGlobalObject*, WrapperMap*> GlobalObjectWrapperMap;
 
 static GlobalObjectWrapperMap& wrappers()
 {
-    static GlobalObjectWrapperMap map;
+    DEFINE_STATIC_LOCAL(GlobalObjectWrapperMap, map, ());
     return map;
 }
 
index 8440a1f..f0ccd00 100644 (file)
@@ -27,6 +27,7 @@
 #include "JSInspectorCallbackWrapper.h"
 
 #include "JSInspectedObjectWrapper.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace JSC;
 
@@ -38,7 +39,7 @@ typedef HashMap<JSObject*, JSInspectorCallbackWrapper*> WrapperMap;
 
 static WrapperMap& wrappers()
 {
-    static WrapperMap map;
+    DEFINE_STATIC_LOCAL(WrapperMap, map, ());
     return map;
 }
 
index a85eb93..fd99bed 100644 (file)
@@ -54,7 +54,7 @@ static bool needsYouTubeQuirk(ExecState* exec, Frame* frame)
     JSFunction* function = exec->function();
     if (!function)
         return false;
-    static const Identifier& isWindowsFunctionName = *new Identifier(exec, "isWindows");
+    DEFINE_STATIC_LOCAL(const Identifier, isWindowsFunctionName, (exec, "isWindows"));
     if (function->functionName() != isWindowsFunctionName)
         return false;
 
@@ -70,7 +70,7 @@ static bool needsYouTubeQuirk(ExecState* exec, Frame* frame)
     JSObject* thisObject = callingExec->thisValue();
     if (!thisObject)
         return false;
-    static const Identifier& isSafariFunctionName = *new Identifier(exec, "isSafari");
+    DEFINE_STATIC_LOCAL(const Identifier, isSafariFunction, (exec, "isSafari"));
     JSValue* isSafariFunction = thisObject->getDirect(isSafariFunctionName);
     if (isSafariFunction != callingFunction)
         return false;
index 027d0c9..8e00fd5 100644 (file)
@@ -30,6 +30,7 @@
 #include <runtime/JSGlobalObject.h>
 #include <wtf/HashCountedSet.h>
 #include <wtf/HashSet.h>
+#include <wtf/StdLibExtras.h>
 
 namespace JSC { namespace Bindings {
 
@@ -42,7 +43,7 @@ typedef HashSet<RootObject*> RootObjectSet;
 
 static RootObjectSet* rootObjectSet()
 {
-    static RootObjectSet staticRootObjectSet;
+    DEFINE_STATIC_LOCAL(RootObjectSet, staticRootObjectSet, ());
     return &staticRootObjectSet;
 }
 
index 1f29eba..3934248 100644 (file)
@@ -30,6 +30,7 @@
 #include "Document.h"
 #include "ExceptionCode.h"
 #include "StyledElement.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -349,8 +350,10 @@ private:
     const int* m_properties;
     unsigned m_length;
 };
+    
+typedef HashMap<int, PropertyLonghand> ShorthandMap;
 
-static void initShorthandMap(HashMap<int, PropertyLonghand>& shorthandMap)
+static void initShorthandMap(ShorthandMap& shorthandMap)
 {
     #define SET_SHORTHAND_MAP_ENTRY(map, propID, array) \
         map.set(propID, PropertyLonghand(array, sizeof(array) / sizeof(array[0])))
@@ -501,7 +504,7 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha
 {
     ec = 0;
 
-    static HashMap<int, PropertyLonghand> shorthandMap;
+    DEFINE_STATIC_LOCAL(ShorthandMap, shorthandMap, ());
     if (shorthandMap.isEmpty())
         initShorthandMap(shorthandMap);
 
index 8a7bb79..fbbdc40 100644 (file)
@@ -31,6 +31,7 @@
 #include "Rect.h"
 #include "RenderStyle.h"
 #include <wtf/ASCIICType.h>
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(DASHBOARD_SUPPORT)
 #include "DashboardRegion.h"
@@ -686,7 +687,7 @@ String CSSPrimitiveValue::cssText() const
             // FIXME: Add list-style and separator
             break;
         case CSS_RECT: {
-            static const String rectParen("rect(");
+            DEFINE_STATIC_LOCAL(const String, rectParen, ("rect("));
 
             Rect* rectVal = getRectValue();
             Vector<UChar> result;
@@ -709,9 +710,9 @@ String CSSPrimitiveValue::cssText() const
         }
         case CSS_RGBCOLOR:
         case CSS_PARSER_HEXCOLOR: {
-            static const String commaSpace(", ");
-            static const String rgbParen("rgb(");
-            static const String rgbaParen("rgba(");
+            DEFINE_STATIC_LOCAL(const String, commaSpace, (", "));
+            DEFINE_STATIC_LOCAL(const String, rgbParen, ("rgb("));
+            DEFINE_STATIC_LOCAL(const String, rgbaParen, ("rgba("));
 
             RGBA32 rgbColor = m_value.rgbcolor;
             if (m_type == CSS_PARSER_HEXCOLOR)
index 9053596..6354e8e 100644 (file)
@@ -24,6 +24,8 @@
 #include "config.h"
 #include "CSSSelector.h"
 
+#include <wtf/StdLibExtras.h>
+
 namespace WebCore {
 
 unsigned int CSSSelector::specificity()
@@ -62,75 +64,75 @@ void CSSSelector::extractPseudoType() const
     if (m_match != PseudoClass && m_match != PseudoElement)
         return;
 
-    static AtomicString active("active");
-    static AtomicString after("after");
-    static AtomicString anyLink("-webkit-any-link");
-    static AtomicString autofill("-webkit-autofill");
-    static AtomicString before("before");
-    static AtomicString checked("checked");
-    static AtomicString fileUploadButton("-webkit-file-upload-button");
-    static AtomicString disabled("disabled");
-    static AtomicString readOnly("read-only");
-    static AtomicString readWrite("read-write");
-    static AtomicString drag("-webkit-drag");
-    static AtomicString dragAlias("-khtml-drag"); // was documented with this name in Apple documentation, so keep an alias
-    static AtomicString empty("empty");
-    static AtomicString enabled("enabled");
-    static AtomicString firstChild("first-child");
-    static AtomicString firstLetter("first-letter");
-    static AtomicString firstLine("first-line");
-    static AtomicString firstOfType("first-of-type");
-    static AtomicString fullPageMedia("-webkit-full-page-media");
-    static AtomicString nthChild("nth-child(");
-    static AtomicString nthOfType("nth-of-type(");
-    static AtomicString nthLastChild("nth-last-child(");
-    static AtomicString nthLastOfType("nth-last-of-type(");
-    static AtomicString focus("focus");
-    static AtomicString hover("hover");
-    static AtomicString indeterminate("indeterminate");
-    static AtomicString inputPlaceholder("-webkit-input-placeholder");
-    static AtomicString lastChild("last-child");
-    static AtomicString lastOfType("last-of-type");
-    static AtomicString link("link");
-    static AtomicString lang("lang(");
-    static AtomicString mediaControlsPanel("-webkit-media-controls-panel");
-    static AtomicString mediaControlsMuteButton("-webkit-media-controls-mute-button");
-    static AtomicString mediaControlsPlayButton("-webkit-media-controls-play-button");
-    static AtomicString mediaControlsTimeDisplay("-webkit-media-controls-time-display");
-    static AtomicString mediaControlsTimeline("-webkit-media-controls-timeline");
-    static AtomicString mediaControlsSeekBackButton("-webkit-media-controls-seek-back-button");
-    static AtomicString mediaControlsSeekForwardButton("-webkit-media-controls-seek-forward-button");
-    static AtomicString mediaControlsFullscreenButton("-webkit-media-controls-fullscreen-button");
-    static AtomicString notStr("not(");
-    static AtomicString onlyChild("only-child");
-    static AtomicString onlyOfType("only-of-type");
-    static AtomicString resizer("-webkit-resizer");
-    static AtomicString root("root");
-    static AtomicString scrollbar("-webkit-scrollbar");
-    static AtomicString scrollbarButton("-webkit-scrollbar-button");
-    static AtomicString scrollbarCorner("-webkit-scrollbar-corner");
-    static AtomicString scrollbarThumb("-webkit-scrollbar-thumb");
-    static AtomicString scrollbarTrack("-webkit-scrollbar-track");
-    static AtomicString scrollbarTrackPiece("-webkit-scrollbar-track-piece");
-    static AtomicString searchCancelButton("-webkit-search-cancel-button");
-    static AtomicString searchDecoration("-webkit-search-decoration");
-    static AtomicString searchResultsDecoration("-webkit-search-results-decoration");
-    static AtomicString searchResultsButton("-webkit-search-results-button");
-    static AtomicString selection("selection");
-    static AtomicString sliderThumb("-webkit-slider-thumb");
-    static AtomicString target("target");
-    static AtomicString visited("visited");
-    static AtomicString windowInactive("window-inactive");
-    static AtomicString decrement("decrement");
-    static AtomicString increment("increment");
-    static AtomicString start("start");
-    static AtomicString end("end");
-    static AtomicString horizontal("horizontal");
-    static AtomicString vertical("vertical");
-    static AtomicString doubleButton("double-button");
-    static AtomicString singleButton("single-button");
-    static AtomicString noButton("no-button");
-    static AtomicString cornerPresent("corner-present");
+    DEFINE_STATIC_LOCAL(AtomicString, active, ("active"));
+    DEFINE_STATIC_LOCAL(AtomicString, after, ("after"));
+    DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link"));
+    DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill"));
+    DEFINE_STATIC_LOCAL(AtomicString, before, ("before"));
+    DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked"));
+    DEFINE_STATIC_LOCAL(AtomicString, fileUploadButton, ("-webkit-file-upload-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled"));
+    DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only"));
+    DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write"));
+    DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag"));
+    DEFINE_STATIC_LOCAL(AtomicString, dragAlias, ("-khtml-drag")); // was documented with this name in Apple documentation, so keep an alia
+    DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty"));
+    DEFINE_STATIC_LOCAL(AtomicString, enabled, ("enabled"));
+    DEFINE_STATIC_LOCAL(AtomicString, firstChild, ("first-child"));
+    DEFINE_STATIC_LOCAL(AtomicString, firstLetter, ("first-letter"));
+    DEFINE_STATIC_LOCAL(AtomicString, firstLine, ("first-line"));
+    DEFINE_STATIC_LOCAL(AtomicString, firstOfType, ("first-of-type"));
+    DEFINE_STATIC_LOCAL(AtomicString, fullPageMedia, ("-webkit-full-page-media"));
+    DEFINE_STATIC_LOCAL(AtomicString, nthChild, ("nth-child("));
+    DEFINE_STATIC_LOCAL(AtomicString, nthOfType, ("nth-of-type("));
+    DEFINE_STATIC_LOCAL(AtomicString, nthLastChild, ("nth-last-child("));
+    DEFINE_STATIC_LOCAL(AtomicString, nthLastOfType, ("nth-last-of-type("));
+    DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus"));
+    DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover"));
+    DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate"));
+    DEFINE_STATIC_LOCAL(AtomicString, inputPlaceholder, ("-webkit-input-placeholder"));
+    DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child"));
+    DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type"));
+    DEFINE_STATIC_LOCAL(AtomicString, link, ("link"));
+    DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang("));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPanel, ("-webkit-media-controls-panel"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsMuteButton, ("-webkit-media-controls-mute-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPlayButton, ("-webkit-media-controls-play-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeDisplay, ("-webkit-media-controls-time-display"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeline, ("-webkit-media-controls-timeline"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekBackButton, ("-webkit-media-controls-seek-back-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not("));
+    DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child"));
+    DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type"));
+    DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer"));
+    DEFINE_STATIC_LOCAL(AtomicString, root, ("root"));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbar, ("-webkit-scrollbar"));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarButton, ("-webkit-scrollbar-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarCorner, ("-webkit-scrollbar-corner"));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarThumb, ("-webkit-scrollbar-thumb"));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track"));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece"));
+    DEFINE_STATIC_LOCAL(AtomicString, searchCancelButton, ("-webkit-search-cancel-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, searchDecoration, ("-webkit-search-decoration"));
+    DEFINE_STATIC_LOCAL(AtomicString, searchResultsDecoration, ("-webkit-search-results-decoration"));
+    DEFINE_STATIC_LOCAL(AtomicString, searchResultsButton, ("-webkit-search-results-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection"));
+    DEFINE_STATIC_LOCAL(AtomicString, sliderThumb, ("-webkit-slider-thumb"));
+    DEFINE_STATIC_LOCAL(AtomicString, target, ("target"));
+    DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited"));
+    DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive"));
+    DEFINE_STATIC_LOCAL(AtomicString, decrement, ("decrement"));
+    DEFINE_STATIC_LOCAL(AtomicString, increment, ("increment"));
+    DEFINE_STATIC_LOCAL(AtomicString, start, ("start"));
+    DEFINE_STATIC_LOCAL(AtomicString, end, ("end"));
+    DEFINE_STATIC_LOCAL(AtomicString, horizontal, ("horizontal"));
+    DEFINE_STATIC_LOCAL(AtomicString, vertical, ("vertical"));
+    DEFINE_STATIC_LOCAL(AtomicString, doubleButton, ("double-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present"));
 
     bool element = false; // pseudo-element
     bool compat = false; // single colon compatbility mode
index 446aaf4..b779cc4 100644 (file)
@@ -88,6 +88,7 @@
 #include "WebKitCSSTransformValue.h"
 #include "XMLNames.h"
 #include "loader.h"
+#include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -372,13 +373,13 @@ static bool elementCanUseSimpleDefaultStyle(Element* e)
 
 static const MediaQueryEvaluator& screenEval()
 {
-    static const MediaQueryEvaluator staticScreenEval("screen");
+    DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, ("screen"));
     return staticScreenEval;
 }
 
 static const MediaQueryEvaluator& printEval()
 {
-    static const MediaQueryEvaluator staticPrintEval("print");
+    DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticPrintEval, ("print"));
     return staticPrintEval;
 }
 
index d7a8903..5b415b1 100644 (file)
@@ -46,6 +46,7 @@
 #include "Settings.h"
 #include "TextDocument.h"
 #include "XMLNames.h"
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(SVG)
 #include "SVGNames.h"
@@ -56,7 +57,9 @@ namespace WebCore {
 
 #if ENABLE(SVG)
 
-static void addString(HashSet<String, CaseFoldingHash>& set, const char* string)
+typedef HashSet<String, CaseFoldingHash> FeatureSet;
+
+static void addString(FeatureSet& set, const char* string)
 {
     set.add(string);
 }
@@ -64,7 +67,7 @@ static void addString(HashSet<String, CaseFoldingHash>& set, const char* string)
 static bool isSVG10Feature(const String &feature)
 {
     static bool initialized = false;
-    static HashSet<String, CaseFoldingHash> svgFeatures;
+    DEFINE_STATIC_LOCAL(FeatureSet, svgFeatures, ());
     if (!initialized) {
 #if ENABLE(SVG_USE) && ENABLE(SVG_FOREIGN_OBJECT) && ENABLE(SVG_FILTER) && ENABLE(SVG_FONTS)
         addString(svgFeatures, "svg");
@@ -89,7 +92,7 @@ static bool isSVG10Feature(const String &feature)
 static bool isSVG11Feature(const String &feature)
 {
     static bool initialized = false;
-    static HashSet<String, CaseFoldingHash> svgFeatures;
+    DEFINE_STATIC_LOCAL(FeatureSet, svgFeatures, ());
     if (!initialized) {
         // Sadly, we cannot claim to implement any of the SVG 1.1 generic feature sets
         // lack of Font and Filter support.
@@ -274,7 +277,7 @@ bool DOMImplementation::isXMLMIMEType(const String& mimeType)
     if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl")
         return true;
     static const char* validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
-    static RegularExpression xmlTypeRegExp(String("^") + validChars + "+/" + validChars + "+\\+xml$");
+    DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validChars + "+/" + validChars + "+\\+xml$"));
     return xmlTypeRegExp.match(mimeType) > -1;
 }
 
index 7c9352b..ec2ed36 100644 (file)
 #include "JSDOMBinding.h"
 #include "ScriptController.h"
 #include <runtime/JSLock.h>
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(DATABASE)
 #include "Database.h"
@@ -713,9 +714,9 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
 
 bool Document::hasPrefixNamespaceMismatch(const QualifiedName& qName)
 {
-    static const AtomicString xmlnsNamespaceURI("http://www.w3.org/2000/xmlns/");
-    static const AtomicString xmlns("xmlns");
-    static const AtomicString xml("xml");
+    DEFINE_STATIC_LOCAL(const AtomicString, xmlnsNamespaceURI, ("http://www.w3.org/2000/xmlns/"));
+    DEFINE_STATIC_LOCAL(const AtomicString, xmlns, ("xmlns"));
+    DEFINE_STATIC_LOCAL(const AtomicString, xml, ("xml"));
 
     // These checks are from DOM Core Level 2, createElementNS
     // http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS
index 5071afc..dd86185 100644 (file)
@@ -33,6 +33,7 @@
 #include "ScriptController.h"
 #include "StringHash.h"
 #include "Text.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -91,7 +92,8 @@ void ScriptElement::handleSourceAttribute(ScriptElementData& data, const String&
 // Helper function
 static bool isSupportedJavaScriptLanguage(const String& language)
 {
-    static HashSet<String, CaseFoldingHash> languages;
+    typedef HashSet<String, CaseFoldingHash> LanguageSet;
+    DEFINE_STATIC_LOCAL(LanguageSet, languages, ());
     if (languages.isEmpty()) {
         languages.add("javascript");
         languages.add("javascript");
index 7cca4b7..825e6e6 100644 (file)
@@ -42,6 +42,7 @@
 #include "TextIterator.h"
 #include "htmlediting.h"
 #include "visible_units.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -229,7 +230,7 @@ bool StyleChange::currentlyHasStyle(const Position &pos, const CSSProperty *prop
 
 static String &styleSpanClassString()
 {
-    static String styleSpanClassString = AppleStyleSpanClass;
+    DEFINE_STATIC_LOCAL(String, styleSpanClassString, ((AppleStyleSpanClass)));
     return styleSpanClassString;
 }
 
index 024ac9f..16b330d 100644 (file)
@@ -29,6 +29,7 @@
 #include "CharacterNames.h"
 #include "Text.h"
 #include "TextIterator.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -36,7 +37,7 @@ namespace {
 
 String convertedSpaceString()
 {
-    static String convertedSpaceString;
+    DEFINE_STATIC_LOCAL(String, convertedSpaceString, ());
     if (convertedSpaceString.isNull()) {
         convertedSpaceString = "<span class=\"";
         convertedSpaceString += AppleConvertedSpace;
index 385f1b7..f27dc79 100644 (file)
@@ -36,6 +36,7 @@
 #include "SplitElementCommand.h"
 #include "TextIterator.h"
 #include "visible_units.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -43,7 +44,7 @@ using namespace HTMLNames;
 
 static String indentBlockquoteString()
 {
-    static String string = "webkit-indent-blockquote";
+    DEFINE_STATIC_LOCAL(String, string, ("webkit-indent-blockquote"));
     return string;
 }
 
index 75b3b4f..2b88a2f 100644 (file)
@@ -49,6 +49,7 @@
 #include "htmlediting.h"
 #include "markup.h"
 #include "visible_units.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -90,14 +91,14 @@ private:
 
 static bool isInterchangeNewlineNode(const Node *node)
 {
-    static String interchangeNewlineClassString(AppleInterchangeNewline);
+    DEFINE_STATIC_LOCAL(String, interchangeNewlineClassString, (AppleInterchangeNewline));
     return node && node->hasTagName(brTag) && 
            static_cast<const Element *>(node)->getAttribute(classAttr) == interchangeNewlineClassString;
 }
 
 static bool isInterchangeConvertedSpaceSpan(const Node *node)
 {
-    static String convertedSpaceSpanClassString(AppleConvertedSpace);
+    DEFINE_STATIC_LOCAL(String, convertedSpaceSpanClassString, (AppleConvertedSpace));
     return node->isHTMLElement() && 
            static_cast<const HTMLElement *>(node)->getAttribute(classAttr) == convertedSpaceSpanClassString;
 }
index 54b5450..b5eb104 100644 (file)
@@ -41,6 +41,7 @@
 #include "TextIterator.h"
 #include "VisiblePosition.h"
 #include "visible_units.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -364,9 +365,9 @@ int maxDeepOffset(const Node *node)
 
 String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfParagraph, bool endIsEndOfParagraph)
 {
-    static String twoSpaces("  ");
-    static String nbsp("\xa0");
-    static String pattern(" \xa0");
+    DEFINE_STATIC_LOCAL(String, twoSpaces, ("  "));
+    DEFINE_STATIC_LOCAL(String, nbsp, ("\xa0"));
+    DEFINE_STATIC_LOCAL(String, pattern, (" \xa0"));
 
     String rebalancedString = string;
 
@@ -393,7 +394,7 @@ bool isTableStructureNode(const Node *node)
 
 const String& nonBreakingSpaceString()
 {
-    static String nonBreakingSpaceString = String(&noBreakSpace, 1);
+    DEFINE_STATIC_LOCAL(String, nonBreakingSpaceString, (&noBreakSpace, 1));
     return nonBreakingSpaceString;
 }
 
index b067002..ad97a58 100644 (file)
@@ -56,6 +56,7 @@
 #include "TextIterator.h"
 #include "htmlediting.h"
 #include "visible_units.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -94,11 +95,11 @@ static void appendAttributeValue(Vector<UChar>& result, const String& attr, bool
     unsigned len = attr.length();
     unsigned lastCopiedFrom = 0;
 
-    static const String ampEntity("&amp;");
-    static const String gtEntity("&gt;");
-    static const String ltEntity("&lt;");
-    static const String quotEntity("&quot;");
-    static const String nbspEntity("&nbsp;");
+    DEFINE_STATIC_LOCAL(const String, ampEntity, ("&amp;"));
+    DEFINE_STATIC_LOCAL(const String, gtEntity, ("&gt;"));
+    DEFINE_STATIC_LOCAL(const String, ltEntity, ("&lt;"));
+    DEFINE_STATIC_LOCAL(const String, quotEntity, ("&quot;"));
+    DEFINE_STATIC_LOCAL(const String, nbspEntity, ("&nbsp;"));
     
     for (unsigned i = 0; i < len; ++i) {
         UChar c = uchars[i];
@@ -142,10 +143,10 @@ static void appendEscapedContent(Vector<UChar>& result, pair<const UChar*, size_
     unsigned len = range.second;
     unsigned lastCopiedFrom = 0;
     
-    static const String ampEntity("&amp;");
-    static const String gtEntity("&gt;");
-    static const String ltEntity("&lt;");
-    static const String nbspEntity("&nbsp;");
+    DEFINE_STATIC_LOCAL(const String, ampEntity, ("&amp;"));
+    DEFINE_STATIC_LOCAL(const String, gtEntity, ("&gt;"));
+    DEFINE_STATIC_LOCAL(const String, ltEntity, ("&lt;"));
+    DEFINE_STATIC_LOCAL(const String, nbspEntity, ("&nbsp;"));
 
     for (unsigned i = 0; i < len; ++i) {
         UChar c = uchars[i];
@@ -316,8 +317,8 @@ static bool shouldAddNamespaceElem(const Element* elem)
 static bool shouldAddNamespaceAttr(const Attribute* attr, HashMap<AtomicStringImpl*, AtomicStringImpl*>& namespaces)
 {
     // Don't add namespace attributes twice
-    static const AtomicString xmlnsURI = "http://www.w3.org/2000/xmlns/";
-    static const QualifiedName xmlnsAttr(nullAtom, "xmlns", xmlnsURI);
+    DEFINE_STATIC_LOCAL(const AtomicString, xmlnsURI, ("http://www.w3.org/2000/xmlns/"));
+    DEFINE_STATIC_LOCAL(const QualifiedName, xmlnsAttr, (nullAtom, "xmlns", xmlnsURI));
     if (attr->name() == xmlnsAttr) {
         namespaces.set(emptyAtom.impl(), attr->value().impl());
         return false;
@@ -342,7 +343,7 @@ static void appendNamespace(Vector<UChar>& result, const AtomicString& prefix, c
     AtomicStringImpl* foundNS = namespaces.get(pre);
     if (foundNS != ns.impl()) {
         namespaces.set(pre, ns.impl());
-        static const String xmlns("xmlns");
+        DEFINE_STATIC_LOCAL(const String, xmlns, ("xmlns"));
         result.append(' ');
         append(result, xmlns);
         if (!prefix.isEmpty()) {
@@ -501,7 +502,7 @@ static void appendStartMarkup(Vector<UChar>& result, const Node *node, const Ran
                 if (convert)
                     style->setProperty(CSSPropertyDisplay, CSSValueInline, true);
                 if (style->length() > 0) {
-                    static const String stylePrefix(" style=\"");
+                    DEFINE_STATIC_LOCAL(const String, stylePrefix, (" style=\""));
                     append(result, stylePrefix);
                     appendAttributeValue(result, style->cssText(), documentIsHTML);
                     result.append('\"');
@@ -702,7 +703,7 @@ String joinMarkups(const Vector<String> preMarkups, const Vector<String>& postMa
 // FIXME: At least, annotation and style info should probably not be included in range.markupString()
 String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterchange annotate, bool convertBlocksToInlines)
 {
-    static const String interchangeNewlineString = String("<br class=\"") + AppleInterchangeNewline + "\">";
+    DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\"" AppleInterchangeNewline "\">"));
 
     if (!range)
         return "";
@@ -905,14 +906,14 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
                 
                 if (style->length()) {
                     Vector<UChar> openTag;
-                    static const String divStyle("<div style=\"");
+                    DEFINE_STATIC_LOCAL(const String, divStyle, ("<div style=\""));
                     append(openTag, divStyle);
                     appendAttributeValue(openTag, style->cssText(), documentIsHTML);
                     openTag.append('\"');
                     openTag.append('>');
                     preMarkups.append(String::adopt(openTag));
 
-                    static const String divCloseTag("</div>");
+                    DEFINE_STATIC_LOCAL(const String, divCloseTag, ("</div>"));
                     markups.append(divCloseTag);
                 }
             } else {
@@ -929,8 +930,8 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
         }
     }
     
-    static const String styleSpanOpen = String("<span class=\"" AppleStyleSpanClass "\" style=\"");
-    static const String styleSpanClose("</span>");
+    DEFINE_STATIC_LOCAL(const String, styleSpanOpen, ("<span class=\"" AppleStyleSpanClass "\" style=\""));
+    DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>"));
     
     // Add a wrapper span with the styles that all of the nodes in the markup inherit.
     Node* parentOfLastClosed = lastClosed ? lastClosed->parentNode() : 0;
index f65e748..a8138bc 100644 (file)
@@ -32,6 +32,7 @@
 #include "HTMLNames.h"
 #include "KeyboardEvent.h"
 #include "RenderButton.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -57,15 +58,15 @@ const AtomicString& HTMLButtonElement::type() const
 {
     switch (m_type) {
         case SUBMIT: {
-            static const AtomicString submit("submit");
+            DEFINE_STATIC_LOCAL(const AtomicString, submit, ("submit"));
             return submit;
         }
         case BUTTON: {
-            static const AtomicString button("button");
+            DEFINE_STATIC_LOCAL(const AtomicString, button, ("button"));
             return button;
         }
         case RESET: {
-            static const AtomicString reset("reset");
+            DEFINE_STATIC_LOCAL(const AtomicString, reset, ("reset"));
             return reset;
         }
     }
index 9307660..6d4b861 100644 (file)
@@ -43,6 +43,7 @@
 #include "TextIterator.h"
 #include "XMLTokenizer.h"
 #include "markup.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -808,7 +809,7 @@ bool HTMLElement::childAllowed(Node *newChild)
 // This unfortunate function is only needed when checking against the DTD.  Other languages (like SVG) won't need this.
 bool HTMLElement::isRecognizedTagName(const QualifiedName& tagName)
 {
-    static HashSet<AtomicStringImpl*> tagList;
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ());
     if (tagList.isEmpty()) {
         size_t tagCount = 0;
         WebCore::QualifiedName** tags = HTMLNames::getHTMLTags(&tagCount);
@@ -822,7 +823,7 @@ bool HTMLElement::isRecognizedTagName(const QualifiedName& tagName)
 // need to be in these two lists.
 HashSet<AtomicStringImpl*>* inlineTagList()
 {
-    static HashSet<AtomicStringImpl*> tagList;
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ());
     if (tagList.isEmpty()) {
         tagList.add(ttTag.localName().impl());
         tagList.add(iTag.localName().impl());
@@ -881,7 +882,7 @@ HashSet<AtomicStringImpl*>* inlineTagList()
 
 HashSet<AtomicStringImpl*>* blockTagList()
 {
-    static HashSet<AtomicStringImpl*> tagList;
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ());
     if (tagList.isEmpty()) {
         tagList.add(addressTag.localName().impl());
         tagList.add(blockquoteTag.localName().impl());
index c4594de..7ee669d 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "HTMLNames.h"
 #include "RenderFieldset.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -55,7 +56,7 @@ bool HTMLFieldSetElement::isFocusable() const
 
 const AtomicString& HTMLFieldSetElement::type() const
 {
-    static const AtomicString fieldset("fieldset");
+    DEFINE_STATIC_LOCAL(const AtomicString, fieldset, ("fieldset"));
     return fieldset;
 }
 
index a802eaf..5d041e2 100644 (file)
@@ -56,6 +56,7 @@
 #include "TextBreakIterator.h"
 #include "TextEvent.h"
 #include "TextIterator.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -373,53 +374,53 @@ const AtomicString& HTMLInputElement::type() const
     // needs to be lowercase according to DOM spec
     switch (inputType()) {
         case BUTTON: {
-            static const AtomicString button("button");
+            DEFINE_STATIC_LOCAL(const AtomicString, button, ("button"));
             return button;
         }
         case CHECKBOX: {
-            static const AtomicString checkbox("checkbox");
+            DEFINE_STATIC_LOCAL(const AtomicString, checkbox, ("checkbox"));
             return checkbox;
         }
         case FILE: {
-            static const AtomicString file("file");
+            DEFINE_STATIC_LOCAL(const AtomicString, file, ("file"));
             return file;
         }
         case HIDDEN: {
-            static const AtomicString hidden("hidden");
+            DEFINE_STATIC_LOCAL(const AtomicString, hidden, ("hidden"));
             return hidden;
         }
         case IMAGE: {
-            static const AtomicString image("image");
+            DEFINE_STATIC_LOCAL(const AtomicString, image, ("image"));
             return image;
         }
         case ISINDEX:
             return emptyAtom;
         case PASSWORD: {
-            static const AtomicString password("password");
+            DEFINE_STATIC_LOCAL(const AtomicString, password, ("password"));
             return password;
         }
         case RADIO: {
-            static const AtomicString radio("radio");
+            DEFINE_STATIC_LOCAL(const AtomicString, radio, ("radio"));
             return radio;
         }
         case RANGE: {
-            static const AtomicString range("range");
+            DEFINE_STATIC_LOCAL(const AtomicString, range, ("range"));
             return range;
         }
         case RESET: {
-            static const AtomicString reset("reset");
+            DEFINE_STATIC_LOCAL(const AtomicString, reset, ("reset"));
             return reset;
         }
         case SEARCH: {
-            static const AtomicString search("search");
+            DEFINE_STATIC_LOCAL(const AtomicString, search, ("search"));
             return search;
         }
         case SUBMIT: {
-            static const AtomicString submit("submit");
+            DEFINE_STATIC_LOCAL(const AtomicString, submit, ("submit"));
             return submit;
         }
         case TEXT: {
-            static const AtomicString text("text");
+            DEFINE_STATIC_LOCAL(const AtomicString, text, ("text"));
             return text;
         }
     }
index b918d78..432a98d 100644 (file)
@@ -33,6 +33,7 @@
 #include "HTMLOptionElement.h"
 #include "SSLKeyGenerator.h"
 #include "Text.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace WebCore;
 
@@ -56,7 +57,7 @@ HTMLKeygenElement::HTMLKeygenElement(Document* doc, HTMLFormElement* f)
 
 const AtomicString& HTMLKeygenElement::type() const
 {
-    static const AtomicString keygen("keygen");
+    DEFINE_STATIC_LOCAL(const AtomicString, keygen, ("keygen"));
     return keygen;
 }
 
index 573f06f..73b112e 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "HTMLNames.h"
 #include "RenderLegend.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -58,7 +59,7 @@ RenderObject* HTMLLegendElement::createRenderer(RenderArena* arena, RenderStyle*
 
 const AtomicString& HTMLLegendElement::type() const
 {
-    static const AtomicString legend("legend");
+    DEFINE_STATIC_LOCAL(const AtomicString, legend, ("legend"));
     return legend;
 }
 
index 0465fb4..5f08d62 100644 (file)
@@ -31,6 +31,7 @@
 #include "HTMLSelectElement.h"
 #include "RenderMenuList.h"
 #include "NodeRenderStyle.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -49,7 +50,7 @@ bool HTMLOptGroupElement::isFocusable() const
 
 const AtomicString& HTMLOptGroupElement::type() const
 {
-    static const AtomicString optgroup("optgroup");
+    DEFINE_STATIC_LOCAL(const AtomicString, optgroup, ("optgroup"));
     return optgroup;
 }
 
index 887a4e5..e18c7f2 100644 (file)
@@ -35,6 +35,7 @@
 #include "RenderMenuList.h"
 #include "Text.h"
 #include "NodeRenderStyle.h"
+#include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -73,7 +74,7 @@ bool HTMLOptionElement::isFocusable() const
 
 const AtomicString& HTMLOptionElement::type() const
 {
-    static const AtomicString option("option");
+    DEFINE_STATIC_LOCAL(const AtomicString, option, ("option"));
     return option;
 }
 
index 4e5f53f..53a7e49 100644 (file)
@@ -52,7 +52,8 @@
 #include "LocalizedStrings.h"
 #include "Settings.h"
 #include "Text.h"
-
+#include <wtf/StdLibExtras.h>
+    
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -832,7 +833,7 @@ bool HTMLParser::mapCreateErrorCheck(Token* t, RefPtr<Node>& result)
 PassRefPtr<Node> HTMLParser::getNode(Token* t)
 {
     // Init our error handling table.
-    static FunctionMap gFunctionMap;
+    DEFINE_STATIC_LOCAL(FunctionMap, gFunctionMap, ());
     if (gFunctionMap.isEmpty()) {
         gFunctionMap.set(aTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
         gFunctionMap.set(addressTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
@@ -943,7 +944,7 @@ void HTMLParser::processCloseTag(Token* t)
 
 bool HTMLParser::isHeaderTag(const AtomicString& tagName)
 {
-    static HashSet<AtomicStringImpl*> headerTags;
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, headerTags, ());
     if (headerTags.isEmpty()) {
         headerTags.add(h1Tag.localName().impl());
         headerTags.add(h2Tag.localName().impl());
@@ -986,7 +987,7 @@ bool HTMLParser::isInline(Node* node) const
 
 bool HTMLParser::isResidualStyleTag(const AtomicString& tagName)
 {
-    static HashSet<AtomicStringImpl*> residualStyleTags;
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, residualStyleTags, ());
     if (residualStyleTags.isEmpty()) {
         residualStyleTags.add(aTag.localName().impl());
         residualStyleTags.add(fontTag.localName().impl());
@@ -1013,7 +1014,7 @@ bool HTMLParser::isResidualStyleTag(const AtomicString& tagName)
 
 bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName)
 {
-    static HashSet<AtomicStringImpl*> unaffectedTags;
+    DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, unaffectedTags, ());
     if (unaffectedTags.isEmpty()) {
         unaffectedTags.add(bodyTag.localName().impl());
         unaffectedTags.add(tableTag.localName().impl());
index 77b1860..96cfee0 100644 (file)
@@ -44,6 +44,7 @@
 #include "RenderListBox.h"
 #include "RenderMenuList.h"
 #include <math.h>
+#include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
 #if PLATFORM(MAC)
@@ -114,8 +115,8 @@ void HTMLSelectElement::recalcStyle( StyleChange ch )
 
 const AtomicString& HTMLSelectElement::type() const
 {
-    static const AtomicString selectMultiple("select-multiple");
-    static const AtomicString selectOne("select-one");
+    DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple"));
+    DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one"));
     return m_multiple ? selectMultiple : selectOne;
 }
 
index 85da131..7616601 100644 (file)
@@ -38,6 +38,7 @@
 #include "RenderTextControl.h"
 #include "Selection.h"
 #include "Text.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -59,7 +60,7 @@ HTMLTextAreaElement::HTMLTextAreaElement(Document* document, HTMLFormElement* fo
 
 const AtomicString& HTMLTextAreaElement::type() const
 {
-    static const AtomicString textarea("textarea");
+    DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea"));
     return textarea;
 }
 
index 91127d1..1c8c18f 100644 (file)
@@ -74,6 +74,7 @@
 #include <profiler/Profile.h>
 #include <profiler/Profiler.h>
 #include <wtf/RefCounted.h>
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(DATABASE)
 #include "Database.h"
@@ -862,20 +863,20 @@ static JSValueRef platform(JSContextRef ctx, JSObjectRef /*function*/, JSObjectR
 {
 #if PLATFORM(MAC)
 #ifdef BUILDING_ON_TIGER
-    static const String platform = "mac-tiger";
+    DEFINE_STATIC_LOCAL(const String, platform, ("mac-tiger"));
 #else
-    static const String platform = "mac-leopard";
+    DEFINE_STATIC_LOCAL(const String, platform, ("mac-leopard"));
 #endif
 #elif PLATFORM(WIN_OS)
-    static const String platform = "windows";
+    DEFINE_STATIC_LOCAL(const String, platform, ("windows"));
 #elif PLATFORM(QT)
-    static const String platform = "qt";
+    DEFINE_STATIC_LOCAL(const String, platform, ("qt"));
 #elif PLATFORM(GTK)
-    static const String platform = "gtk";
+    DEFINE_STATIC_LOCAL(const String, platform, ("gtk"));
 #elif PLATFORM(WX)
-    static const String platform = "wx";
+    DEFINE_STATIC_LOCAL(const String, platform, ("wx"));
 #else
-    static const String platform = "unknown";
+    DEFINE_STATIC_LOCAL(const String, platform, ("unknown"));
 #endif
 
     JSValueRef platformValue = JSValueMakeString(ctx, jsStringRef(platform).get());
index 5f480a2..621a29a 100644 (file)
@@ -49,6 +49,7 @@
 #include <runtime/JSLock.h>
 #include <parser/Parser.h>
 #include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
 #include <wtf/UnusedParam.h>
 
 using namespace JSC;
@@ -59,7 +60,7 @@ typedef JavaScriptDebugServer::ListenerSet ListenerSet;
 
 JavaScriptDebugServer& JavaScriptDebugServer::shared()
 {
-    static JavaScriptDebugServer server;
+    DEFINE_STATIC_LOCAL(JavaScriptDebugServer, server, ());
     return server;
 }
 
index 3ebdd55..33028e7 100644 (file)
@@ -34,6 +34,7 @@
 #include <JavaScriptCore/OpaqueJSString.h>
 #include <runtime/JSObject.h>
 #include <runtime/JSValue.h>
+#include <wtf/StdLibExtras.h>
 
 using namespace JSC;
 
@@ -45,7 +46,7 @@ typedef HashMap<Profile*, JSObject*> ProfileMap;
 
 static ProfileMap& profileCache()
 { 
-    static ProfileMap staticProfiles;
+    DEFINE_STATIC_LOCAL(ProfileMap, staticProfiles, ());
     return staticProfiles;
 }
 
index ef2b2cd..7b8528e 100644 (file)
@@ -35,6 +35,7 @@
 #include <JavaScriptCore/JSStringRef.h>
 #include <runtime/JSLock.h>
 #include <runtime/JSValue.h>
+#include <wtf/StdLibExtras.h>
 
 using namespace JSC;
 
@@ -46,7 +47,7 @@ typedef HashMap<ProfileNode*, JSObject*> ProfileNodeMap;
 
 static ProfileNodeMap& profileNodeCache()
 { 
-    static ProfileNodeMap staticProfileNodes;
+    DEFINE_STATIC_LOCAL(ProfileNodeMap, staticProfileNodes, ());
     return staticProfileNodes;
 }
 
index 117cadc..49dea02 100644 (file)
@@ -88,6 +88,7 @@
 #include "ScriptController.h"
 #include <runtime/JSLock.h>
 #include <runtime/JSObject.h>
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
 #include "ApplicationCache.h"
@@ -117,6 +118,8 @@ using namespace HTMLNames;
 const unsigned int cMaxPendingSourceLengthInLowBandwidthDisplay = 128 * 1024;
 #endif
 
+typedef HashSet<String, CaseFoldingHash> LocalSchemesMap;
+
 struct FormSubmission {
     const char* action;
     String url;
@@ -1170,9 +1173,9 @@ bool FrameLoader::allowSubstituteDataAccessToLocal()
     return localLoadPolicy != FrameLoader::AllowLocalLoadsForLocalOnly;
 }
 
-static HashSet<String, CaseFoldingHash>& localSchemes()
+static LocalSchemesMap& localSchemes()
 {
-    static HashSet<String, CaseFoldingHash> localSchemes;
+    DEFINE_STATIC_LOCAL(LocalSchemesMap, localSchemes, ());
 
     if (localSchemes.isEmpty()) {
         localSchemes.add("file");
index 3443f77..42e2933 100644 (file)
@@ -36,6 +36,7 @@
 #include "KURL.h"
 #include "SQLiteStatement.h"
 #include "SQLiteTransaction.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -659,7 +660,7 @@ bool ApplicationCacheStorage::storeCopyOfCache(const String& cacheDirectory, App
     
 ApplicationCacheStorage& cacheStorage()
 {
-    static ApplicationCacheStorage storage;
+    DEFINE_STATIC_LOCAL(ApplicationCacheStorage, storage, ());
     
     return storage;
 }
index c42b5df..1322dbb 100644 (file)
 
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
 typedef PassRefPtr<Archive> RawDataCreationFunction(SharedBuffer*);
+typedef HashMap<String, RawDataCreationFunction*, CaseFoldingHash> ArchiveMIMETypesMap;
 
 // The create functions in the archive classes return PassRefPtr to concrete subclasses
 // of Archive. This adaptor makes the functions have a uniform return type.
@@ -49,9 +51,9 @@ template <typename ArchiveClass> static PassRefPtr<Archive> archiveFactoryCreate
     return ArchiveClass::create(buffer);
 }
 
-static HashMap<String, RawDataCreationFunction*, CaseFoldingHash>& archiveMIMETypes()
+static ArchiveMIMETypesMap& archiveMIMETypes()
 {
-    static HashMap<String, RawDataCreationFunction*, CaseFoldingHash> mimeTypes;
+    DEFINE_STATIC_LOCAL(ArchiveMIMETypesMap, mimeTypes, ());
     static bool initialized = false;
     
     if (initialized)
@@ -79,8 +81,8 @@ PassRefPtr<Archive> ArchiveFactory::create(SharedBuffer* data, const String& mim
 void ArchiveFactory::registerKnownArchiveMIMETypes()
 {
     HashSet<String>& mimeTypes = MIMETypeRegistry::getSupportedNonImageMIMETypes();
-    HashMap<String, RawDataCreationFunction*, CaseFoldingHash>::iterator i = archiveMIMETypes().begin();
-    HashMap<String, RawDataCreationFunction*, CaseFoldingHash>::iterator end = archiveMIMETypes().end();
+    ArchiveMIMETypesMap::iterator i = archiveMIMETypes().begin();
+    ArchiveMIMETypesMap::iterator end = archiveMIMETypes().end();
     
     for (; i != end; ++i)
         mimeTypes.add(i->first);
index 493b631..82edb4f 100644 (file)
@@ -43,6 +43,7 @@
 #include "SystemTime.h"
 #include <runtime/InitializeThreading.h>
 #include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
 
 #if PLATFORM(WIN_OS)
 #include <windows.h>
@@ -850,7 +851,7 @@ String IconDatabase::databasePath() const
 
 String IconDatabase::defaultDatabaseFilename()
 {
-    static String defaultDatabaseFilename = "WebpageIcons.db";
+    DEFINE_STATIC_LOCAL(String, defaultDatabaseFilename, ("WebpageIcons.db"));
     return defaultDatabaseFilename.copy();
 }
 
index 80f79d4..7b45357 100644 (file)
@@ -63,6 +63,7 @@
 #include "SelectionController.h"
 #include "Settings.h"
 #include "TextEvent.h"
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(SVG)
 #include "SVGDocument.h"
@@ -150,7 +151,7 @@ EventHandler::~EventHandler()
     
 EventHandler::EventHandlerDragState& EventHandler::dragState()
 {
-    static EventHandlerDragState state;
+    DEFINE_STATIC_LOCAL(EventHandlerDragState, state, ());
     return state;
 }
     
index ece9088..a88eace 100644 (file)
@@ -76,6 +76,7 @@
 #include "runtime_root.h"
 #include "visible_units.h"
 #include <wtf/RefCountedLeakCounter.h>
+#include <wtf/StdLibExtras.h>
 
 #if FRAME_LOADS_USER_STYLESHEET
 #include "UserStyleSheetLoader.h"
@@ -317,7 +318,7 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
     // REVIEW- version of this call in FrameMac.mm caches based on the NSArray ptrs being
     // the same across calls.  We can't do that.
 
-    static RegularExpression wordRegExp = RegularExpression("\\w");
+    DEFINE_STATIC_LOCAL(RegularExpression, wordRegExp, ("\\w"));
     String pattern("(");
     unsigned int numLabels = labels.size();
     unsigned int i;
@@ -1027,7 +1028,7 @@ void Frame::removeEditingStyleFromElement(Element*) const
 #ifndef NDEBUG
 static HashSet<Frame*>& keepAliveSet()
 {
-    static HashSet<Frame*> staticKeepAliveSet;
+    DEFINE_STATIC_LOCAL(HashSet<Frame*>, staticKeepAliveSet, ());
     return staticKeepAliveSet;
 }
 #endif
index 18c9941..983b686 100644 (file)
@@ -54,6 +54,7 @@
 #include <runtime/JSLock.h>
 #include <wtf/HashMap.h>
 #include <wtf/RefCountedLeakCounter.h>
+#include <wtf/StdLibExtras.h>
 
 #if ENABLE(DOM_STORAGE)
 #include "LocalStorage.h"
@@ -233,7 +234,7 @@ void Page::setGroupName(const String& name)
 
 const String& Page::groupName() const
 {
-    static String nullString;
+    DEFINE_STATIC_LOCAL(String, nullString, ());
     return m_group ? m_group->name() : nullString;
 }
 
index 6de7508..792c3bb 100644 (file)
@@ -33,6 +33,7 @@
 #include "FrameLoader.h"
 #include "KURL.h"
 #include "PlatformString.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -41,7 +42,8 @@ static bool isDefaultPortForProtocol(unsigned short port, const String& protocol
     if (protocol.isEmpty())
         return false;
 
-    static HashMap<String, unsigned> defaultPorts;
+    typedef HashMap<String, unsigned> DefaultPortsMap;
+    DEFINE_STATIC_LOCAL(DefaultPortsMap, defaultPorts, ());
     if (defaultPorts.isEmpty()) {
         defaultPorts.set("http", 80);
         defaultPorts.set("https", 443);
@@ -260,7 +262,7 @@ PassRefPtr<SecurityOrigin> SecurityOrigin::createFromDatabaseIdentifier(const St
 
 String SecurityOrigin::databaseIdentifier() const 
 {
-    static String separatorString = String(&SeparatorCharacter, 1);
+    DEFINE_STATIC_LOCAL(String, separatorString, (&SeparatorCharacter, 1));
     return m_protocol + separatorString + m_host + separatorString + String::number(m_port); 
 }
 
index 66e2d04..0e6fa77 100644 (file)
@@ -59,6 +59,7 @@
 
 #import <Carbon/Carbon.h>
 #import <runtime/JSLock.h>
+#import <wtf/StdLibExtras.h>
 
 #if ENABLE(DASHBOARD_SUPPORT)
 #import "WebDashboardRegion.h"
@@ -88,8 +89,8 @@ RegularExpression* regExpForLabels(NSArray* labels)
     // that the app will use is equal to the number of locales is used in searching.
     static const unsigned int regExpCacheSize = 4;
     static NSMutableArray* regExpLabels = nil;
-    static Vector<RegularExpression*> regExps;
-    static RegularExpression wordRegExp = RegularExpression("\\w");
+    DEFINE_STATIC_LOCAL(Vector<RegularExpression*>, regExps, ());
+    DEFINE_STATIC_LOCAL(RegularExpression, wordRegExp, ("\\w"));
 
     RegularExpression* result;
     if (!regExpLabels)
index ae33720..66fb463 100644 (file)
@@ -29,6 +29,7 @@
 #include "CString.h"
 #include "PlatformString.h"
 #include "TextEncoding.h"
+#include <wtf/StdLibExtras.h>
 
 #if USE(ICU_UNICODE)
 #include <unicode/uidna.h>
@@ -1563,7 +1564,7 @@ String mimeTypeFromDataURL(const String& url)
 
 const KURL& blankURL()
 {
-    static KURL staticBlankURL("about:blank");
+    DEFINE_STATIC_LOCAL(KURL, staticBlankURL, ("about:blank"));
     return staticBlankURL;
 }
 
index 1c5a987..d09c0b5 100644 (file)
@@ -37,6 +37,7 @@
 #include "StringHash.h"
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
+#include <wtf/StdLibExtras.h>
 
 using namespace WTF;
 
@@ -124,21 +125,24 @@ static FontPlatformDataCache* gFontPlatformDataCache = 0;
 static const AtomicString& alternateFamilyName(const AtomicString& familyName)
 {
     // Alias Courier <-> Courier New
-    static AtomicString courier("Courier"), courierNew("Courier New");
+    DEFINE_STATIC_LOCAL(AtomicString, courier, ("Courier"));
+    DEFINE_STATIC_LOCAL(AtomicString, courierNew, ("Courier New"));
     if (equalIgnoringCase(familyName, courier))
         return courierNew;
     if (equalIgnoringCase(familyName, courierNew))
         return courier;
 
     // Alias Times and Times New Roman.
-    static AtomicString times("Times"), timesNewRoman("Times New Roman");
+    DEFINE_STATIC_LOCAL(AtomicString, times, ("Times"));
+    DEFINE_STATIC_LOCAL(AtomicString, timesNewRoman, ("Times New Roman"));
     if (equalIgnoringCase(familyName, times))
         return timesNewRoman;
     if (equalIgnoringCase(familyName, timesNewRoman))
         return times;
     
     // Alias Arial and Helvetica
-    static AtomicString arial("Arial"), helvetica("Helvetica");
+    DEFINE_STATIC_LOCAL(AtomicString, arial, ("Arial"));
+    DEFINE_STATIC_LOCAL(AtomicString, helvetica, ("Helvetica"));
     if (equalIgnoringCase(familyName, arial))
         return helvetica;
     if (equalIgnoringCase(familyName, helvetica))
index e7cda66..dc45490 100644 (file)
@@ -35,6 +35,7 @@
 #import "FontPlatformData.h"
 #import "WebCoreSystemInterface.h"
 #import "WebFontCache.h"
+#include <wtf/StdLibExtras.h>
 
 #ifdef BUILDING_ON_TIGER
 typedef int NSInteger;
@@ -140,7 +141,7 @@ FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
     while (currFamily && !platformData) {
         if (currFamily->family().length()) {
             static String matchWords[3] = { String("Arabic"), String("Pashto"), String("Urdu") };
-            static AtomicString geezaStr("Geeza Pro");
+            DEFINE_STATIC_LOCAL(AtomicString, geezaStr, ("Geeza Pro"));
             for (int j = 0; j < 3 && !platformData; ++j)
                 if (currFamily->family().contains(matchWords[j], false))
                     platformData = getCachedFontPlatformData(font.fontDescription(), geezaStr);
@@ -153,8 +154,8 @@ FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
 
 FontPlatformData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
 {
-    static AtomicString timesStr("Times");
-    static AtomicString lucidaGrandeStr("Lucida Grande");
+    DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times"));
+    DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande"));
 
     // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
     // the default that the user would get without changing any prefs.
index 8ee7673..c28f149 100644 (file)
@@ -30,6 +30,7 @@
 #import "FoundationExtras.h"
 #import "Image.h"
 #import "IntPoint.h"
+#import <wtf/StdLibExtras.h>
 
 @interface WebCoreCursorBundle : NSObject { }
 @end
@@ -56,7 +57,7 @@ static NSCursor* createCustomCursor(Image* image, const IntPoint& hotspot)
 
 // Leak these cursors intentionally, that way we won't waste time trying to clean them
 // up at process exit time.
-static Cursor& leakNamedCursor(const char* name, int x, int y)
+static NSCursor* leakNamedCursor(const char* name, int x, int y)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     NSString* resourceName = [[NSString alloc] initWithUTF8String:name];
@@ -70,9 +71,9 @@ static Cursor& leakNamedCursor(const char* name, int x, int y)
         cursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpotPoint];
         [cursorImage release];
     }
-    return *new Cursor(cursor);
+    return cursor;
     END_BLOCK_OBJC_EXCEPTIONS;
-    return *new Cursor;
+    return nil;
 }
 
 Cursor::Cursor(Image* image, const IntPoint& hotspot)
@@ -105,193 +106,193 @@ Cursor::Cursor(NSCursor* c)
 
 const Cursor& pointerCursor()
 {
-    static Cursor& c = *new Cursor([NSCursor arrowCursor]);
+    DEFINE_STATIC_LOCAL(Cursor, c, ([NSCursor arrowCursor]));
     return c;
 }
 
 const Cursor& crossCursor()
 {
-    static Cursor& c = leakNamedCursor("crossHairCursor", 11, 11);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("crossHairCursor", 11, 11)));
     return c;
 }
 
 const Cursor& handCursor()
 {
-    static Cursor& c = leakNamedCursor("linkCursor", 6, 1);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("linkCursor", 6, 1)));
     return c;
 }
 
 const Cursor& moveCursor()
 {
-    static Cursor& c = leakNamedCursor("moveCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("moveCursor", 7, 7)));
     return c;
 }
 
 const Cursor& verticalTextCursor()
 {
-    static Cursor& c = leakNamedCursor("verticalTextCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("verticalTextCursor", 7, 7)));
     return c;
 }
 
 const Cursor& cellCursor()
 {
-    static Cursor& c = leakNamedCursor("cellCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("cellCursor", 7, 7)));
     return c;
 }
 
 const Cursor& contextMenuCursor()
 {
-    static Cursor& c = leakNamedCursor("contextMenuCursor", 3, 2);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("contextMenuCursor", 3, 2)));
     return c;
 }
 
 const Cursor& aliasCursor()
 {
-    static Cursor& c = leakNamedCursor("aliasCursor", 11, 3);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("aliasCursor", 11, 3)));
     return c;
 }
 
 const Cursor& zoomInCursor()
 {
-    static Cursor& c = leakNamedCursor("zoomInCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("zoomInCursor", 7, 7)));
     return c;
 }
 
 const Cursor& zoomOutCursor()
 {
-    static Cursor& c = leakNamedCursor("zoomOutCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("zoomOutCursor", 7, 7)));
     return c;
 }
 
 const Cursor& copyCursor()
 {
-    static Cursor& c = leakNamedCursor("copyCursor", 3, 2);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("copyCursor", 3, 2)));
     return c;
 }
 
 const Cursor& noneCursor()
 {
-    static Cursor& c = leakNamedCursor("noneCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("noneCursor", 7, 7)));
     return c;
 }
 
 const Cursor& progressCursor()
 {
-    static Cursor& c = leakNamedCursor("progressCursor", 3, 2);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("progressCursor", 3, 2)));
     return c;
 }
 
 const Cursor& noDropCursor()
 {
-    static Cursor& c = leakNamedCursor("noDropCursor", 3, 1);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("noDropCursor", 3, 1)));
     return c;
 }
 
 const Cursor& notAllowedCursor()
 {
-    static Cursor& c = leakNamedCursor("notAllowedCursor", 11, 11);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("notAllowedCursor", 11, 11)));
     return c;
 }
 
 const Cursor& iBeamCursor()
 {
-    static Cursor& c = *new Cursor([NSCursor IBeamCursor]);
+    DEFINE_STATIC_LOCAL(Cursor, c, ([NSCursor IBeamCursor]));
     return c;
 }
 
 const Cursor& waitCursor()
 {
-    static Cursor& c = leakNamedCursor("waitCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("waitCursor", 7, 7)));
     return c;
 }
 
 const Cursor& helpCursor()
 {
-    static Cursor& c = leakNamedCursor("helpCursor", 8, 8);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("helpCursor", 8, 8)));
     return c;
 }
 
 const Cursor& eastResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("eastResizeCursor", 14, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("eastResizeCursor", 14, 7)));
     return c;
 }
 
 const Cursor& northResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("northResizeCursor", 7, 1);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("northResizeCursor", 7, 1)));
     return c;
 }
 
 const Cursor& northEastResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("northEastResizeCursor", 14, 1);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("northEastResizeCursor", 14, 1)));
     return c;
 }
 
 const Cursor& northWestResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("northWestResizeCursor", 0, 0);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("northWestResizeCursor", 0, 0)));
     return c;
 }
 
 const Cursor& southResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("southResizeCursor", 7, 14);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("southResizeCursor", 7, 14)));
     return c;
 }
 
 const Cursor& southEastResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("southEastResizeCursor", 14, 14);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("southEastResizeCursor", 14, 14)));
     return c;
 }
 
 const Cursor& southWestResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("southWestResizeCursor", 1, 14);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("southWestResizeCursor", 1, 14)));
     return c;
 }
 
 const Cursor& westResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("westResizeCursor", 1, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("westResizeCursor", 1, 7)));
     return c;
 }
 
 const Cursor& northSouthResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("northSouthResizeCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("northSouthResizeCursor", 7, 7)));
     return c;
 }
 
 const Cursor& eastWestResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("eastWestResizeCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("eastWestResizeCursor", 7, 7)));
     return c;
 }
 
 const Cursor& northEastSouthWestResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("northEastSouthWestResizeCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("northEastSouthWestResizeCursor", 7, 7)));
     return c;
 }
 
 const Cursor& northWestSouthEastResizeCursor()
 {
-    static Cursor& c = leakNamedCursor("northWestSouthEastResizeCursor", 7, 7);
+    DEFINE_STATIC_LOCAL(Cursor, c, (leakNamedCursor("northWestSouthEastResizeCursor", 7, 7)));
     return c;
 }
 
 const Cursor& columnResizeCursor()
 {
-    static Cursor& c = *new Cursor([NSCursor resizeLeftRightCursor]);
+    DEFINE_STATIC_LOCAL(Cursor, c, ([NSCursor resizeLeftRightCursor]));
     return c;
 }
 
 const Cursor& rowResizeCursor()
 {
-    static Cursor& c = *new Cursor([NSCursor resizeUpDownCursor]);
+    DEFINE_STATIC_LOCAL(Cursor, c, ([NSCursor resizeUpDownCursor]));
     return c;
 }
 
@@ -342,13 +343,13 @@ const Cursor& westPanningCursor()
 
 const Cursor& grabCursor()
 {
-    static Cursor& c = *new Cursor([NSCursor openHandCursor]);
+    DEFINE_STATIC_LOCAL(Cursor, c, ([NSCursor openHandCursor]));
     return c;
 }
 
 const Cursor& grabbingCursor()
 {
-    static Cursor& c = *new Cursor([NSCursor closedHandCursor]);
+    DEFINE_STATIC_LOCAL(Cursor, c, ([NSCursor closedHandCursor]));
     return c;
 }
 
index dd2c233..b39b8bc 100644 (file)
@@ -34,6 +34,7 @@
 #include "Scrollbar.h"
 #include "ScrollbarClient.h"
 #include "Settings.h"
+#include <wtf/StdLibExtras.h>
 
 #include <Carbon/Carbon.h>
 
@@ -86,7 +87,7 @@ namespace WebCore {
 
 ScrollbarTheme* ScrollbarTheme::nativeTheme()
 {
-    static ScrollbarThemeMac theme;
+    DEFINE_STATIC_LOCAL(ScrollbarThemeMac, theme, ());
     return &theme;
 }
 
index 3b1da55..a3e743f 100644 (file)
@@ -30,6 +30,7 @@
 #import "LocalCurrentGraphicsContext.h"
 #import "ScrollView.h"
 #import "WebCoreSystemInterface.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -46,7 +47,7 @@ enum {
 
 Theme* platformTheme()
 {
-    static ThemeMac themeMac;
+    DEFINE_STATIC_LOCAL(ThemeMac, themeMac, ());
     return &themeMac;
 }
 
index 6320c70..b862598 100644 (file)
@@ -28,6 +28,7 @@
 
 #import "StringHash.h"
 #import <wtf/HashSet.h>
+#import <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -79,7 +80,7 @@ void reportThreadViolation(const char* function)
 void WebCoreReportThreadViolation(const char* function)
 {
     using namespace WebCore;
-    static HashSet<String> loggedFunctions;
+    DEFINE_STATIC_LOCAL(HashSet<String>, loggedFunctions, ());
     switch (threadViolationBehavior) {
         case NoThreadCheck:
             break;
index d39fc30..7239e2c 100644 (file)
 #include "NetworkStateNotifier.h"
 
 #include <wtf/Assertions.h>
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
 NetworkStateNotifier& networkStateNotifier()
 {
-    static NetworkStateNotifier networkStateNotifier;
+    DEFINE_STATIC_LOCAL(NetworkStateNotifier, networkStateNotifier, ());
     
     return networkStateNotifier;
 }
index 3ef224d..134d05f 100644 (file)
@@ -42,6 +42,7 @@
 #import <wtf/Assertions.h>
 #import <wtf/HashMap.h>
 #import <wtf/MainThread.h>
+#import <wtf/StdLibExtras.h>
 #import <wtf/Threading.h>
 
 namespace WebCore {
@@ -49,14 +50,14 @@ namespace WebCore {
 typedef HashMap<CFReadStreamRef, RefPtr<FormData> > StreamFormDataMap;
 static StreamFormDataMap& getStreamFormDataMap()
 {
-    static StreamFormDataMap streamFormDataMap;
+    DEFINE_STATIC_LOCAL(StreamFormDataMap, streamFormDataMap, ());
     return streamFormDataMap;
 }
 
 typedef HashMap<CFReadStreamRef, RefPtr<ResourceHandle> > StreamResourceHandleMap;
 static StreamResourceHandleMap& getStreamResourceHandleMap()
 {
-    static StreamResourceHandleMap streamResourceHandleMap;
+    DEFINE_STATIC_LOCAL(StreamResourceHandleMap, streamResourceHandleMap, ());
     return streamResourceHandleMap;
 }
 
index f60b496..d501b31 100644 (file)
@@ -28,6 +28,7 @@
 
 #import "WebCoreURLResponse.h"
 #import <Foundation/Foundation.h>
+#import <wtf/StdLibExtras.h>
 #import <limits>
 
 @interface NSURLResponse (FoundationSecretsWebCoreKnowsAbout)
@@ -99,7 +100,7 @@ void ResourceResponse::platformLazyInit()
         // is returning incorrect MIME type for local .xhtml files) which is only required in Leopard.
         if (m_url.isLocalFile() && m_mimeType == "text/html") {
             const String& path = m_url.path();
-            static const String xhtmlExt(".xhtml");
+            DEFINE_STATIC_LOCAL(const String, xhtmlExt, (".xhtml"));
             if (path.endsWith(xhtmlExt, false))
                 m_mimeType = "application/xhtml+xml";
         }
index 9026049..a3234a7 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 #include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -122,7 +123,7 @@ bool TextEncoding::isJapanese() const
     if (noExtendedTextEncodingNameUsed())
         return false;
 
-    static HashSet<const char*> set;
+    DEFINE_STATIC_LOCAL(HashSet<const char*>, set, ());
     if (set.isEmpty()) {
         addEncodingName(set, "x-mac-japanese");
         addEncodingName(set, "cp932");
index a7067f1..7528676 100644 (file)
 
 #include "config.h"
 #include "PluginMainThreadScheduler.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
 PluginMainThreadScheduler& PluginMainThreadScheduler::scheduler()
 {
-    static PluginMainThreadScheduler& scheduler = *new PluginMainThreadScheduler;
+    DEFINE_STATIC_LOCAL(PluginMainThreadScheduler, scheduler, ());
 
     return scheduler;
 }
index c590703..44c474b 100644 (file)
@@ -39,6 +39,7 @@
 #include "RenderTheme.h"
 #include "RenderView.h"
 #include "SelectionController.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 using namespace WTF;
@@ -70,6 +71,8 @@ static PercentHeightDescendantsMap* gPercentHeightDescendantsMap = 0;
 
 typedef WTF::HashMap<const RenderBox*, HashSet<RenderBlock*>*> PercentHeightContainerMap;
 static PercentHeightContainerMap* gPercentHeightContainerMap = 0;
+    
+typedef WTF::HashMap<RenderBlock*, RenderFlowSequencedSet*> ContinuationOutlineTableMap;
 
 // Our MarginInfo state used when laying out block children.
 RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int top, int bottom)
@@ -1783,9 +1786,9 @@ void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty)
     }
 }
 
-HashMap<RenderBlock*, RenderFlowSequencedSet*>* continuationOutlineTable()
+ContinuationOutlineTableMap* continuationOutlineTable()
 {
-    static HashMap<RenderBlock*, RenderFlowSequencedSet*> table;
+    DEFINE_STATIC_LOCAL(ContinuationOutlineTableMap, table, ());
     return &table;
 }
 
@@ -1795,7 +1798,7 @@ void RenderBlock::addContinuationWithOutline(RenderFlow* flow)
     // way of painting.
     ASSERT(!flow->layer());
     
-    HashMap<RenderBlock*, RenderFlowSequencedSet*>* table = continuationOutlineTable();
+    ContinuationOutlineTableMap* table = continuationOutlineTable();
     RenderFlowSequencedSet* continuations = table->get(this);
     if (!continuations) {
         continuations = new RenderFlowSequencedSet;
@@ -1807,7 +1810,7 @@ void RenderBlock::addContinuationWithOutline(RenderFlow* flow)
 
 void RenderBlock::paintContinuationOutlines(PaintInfo& info, int tx, int ty)
 {
-    HashMap<RenderBlock*, RenderFlowSequencedSet*>* table = continuationOutlineTable();
+    ContinuationOutlineTableMap* table = continuationOutlineTable();
     if (table->isEmpty())
         return;
         
index 4b6deed..598f40d 100644 (file)
@@ -29,6 +29,7 @@
 #include "RenderListItem.h"
 #include "RenderListMarker.h"
 #include "RenderStyle.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -41,7 +42,7 @@ static CounterNode* counter(RenderObject*, const AtomicString& counterName, bool
 
 static CounterMaps& counterMaps()
 {
-    static CounterMaps staticCounterMaps;
+    DEFINE_STATIC_LOCAL(CounterMaps, staticCounterMaps, ());
     return staticCounterMaps;
 }
 
index e0d8867..08bc567 100644 (file)
@@ -28,6 +28,7 @@
 #include "CharacterNames.h"
 #include "RenderLayer.h"
 #include "RenderView.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -771,7 +772,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
                     continue;
 
                 const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' };
-                static AtomicString ellipsisAndSpaceStr(ellipsisAndSpace, 2);
+                DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace, 2));
 
                 const Font& font = style(numVisibleLines == 1)->font();
                 int ellipsisAndSpaceWidth = font.width(TextRun(ellipsisAndSpace, 2));
index b69612e..f88f131 100644 (file)
@@ -31,6 +31,7 @@
 #include "HTMLOListElement.h"
 #include "RenderListMarker.h"
 #include "RenderView.h"
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -289,7 +290,7 @@ const String& RenderListItem::markerText() const
 {
     if (m_marker)
         return m_marker->text();
-    static String staticNullString;
+    DEFINE_STATIC_LOCAL(String, staticNullString, ());
     return staticNullString;
 }
 
index 2b375d0..d7cfb2b 100644 (file)
 #include "config.h"
 #include "RenderScrollbarTheme.h"
 #include "RenderScrollbar.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
 RenderScrollbarTheme* RenderScrollbarTheme::renderScrollbarTheme()
 {
-    static RenderScrollbarTheme theme;
+    DEFINE_STATIC_LOCAL(RenderScrollbarTheme, theme, ());
     return &theme;
 }
 
index f04ef1b..789f0b2 100644 (file)
@@ -40,6 +40,7 @@
 #import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/StdLibExtras.h>
 #import <math.h>
 
 #ifdef BUILDING_ON_TIGER
@@ -168,13 +169,13 @@ static FontWeight toFontWeight(NSInteger appKitFontWeight)
 
 void RenderThemeMac::systemFont(int cssValueId, FontDescription& fontDescription) const
 {
-    static FontDescription systemFont;
-    static FontDescription smallSystemFont;
-    static FontDescription menuFont;
-    static FontDescription labelFont;
-    static FontDescription miniControlFont;
-    static FontDescription smallControlFont;
-    static FontDescription controlFont;
+    DEFINE_STATIC_LOCAL(FontDescription, systemFont, ());
+    DEFINE_STATIC_LOCAL(FontDescription, smallSystemFont, ());
+    DEFINE_STATIC_LOCAL(FontDescription, menuFont, ());
+    DEFINE_STATIC_LOCAL(FontDescription, labelFont, ());
+    DEFINE_STATIC_LOCAL(FontDescription, miniControlFont, ());
+    DEFINE_STATIC_LOCAL(FontDescription, smallControlFont, ());
+    DEFINE_STATIC_LOCAL(FontDescription, controlFont, ());
 
     FontDescription* cachedDesc;
     NSFont* font = nil;
index 77b4b19..6ff2d59 100644 (file)
@@ -35,6 +35,7 @@
 #include "break_lines.h"
 #include <wtf/AlwaysInline.h>
 #include <wtf/RefCountedLeakCounter.h>
+#include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
 using namespace std;
@@ -2192,7 +2193,7 @@ void RenderBlock::checkLinesForTextOverflow()
     // Determine the width of the ellipsis using the current font.
     // FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP) if horizontal ellipsis is "not renderable"
     TextRun ellipsisRun(&horizontalEllipsis, 1);
-    static AtomicString ellipsisStr(&horizontalEllipsis, 1);
+    DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1));
     const Font& firstLineFont = firstLineStyle()->font();
     const Font& font = style()->font();
     int firstLineEllipsisWidth = firstLineFont.width(ellipsisRun);
index 5088c33..ccee392 100644 (file)
@@ -29,6 +29,7 @@
 #include "RenderArena.h"
 #include "RenderObject.h"
 #include "StyleImage.h"
+#include <wtf/StdLibExtras.h>
 #include <algorithm>
 
 namespace WebCore {
@@ -720,13 +721,13 @@ CounterDirectiveMap& RenderStyle::accessCounterDirectives()
 #if ENABLE(DASHBOARD_SUPPORT)
 const Vector<StyleDashboardRegion>& RenderStyle::initialDashboardRegions()
 {
-    static Vector<StyleDashboardRegion> emptyList;
+    DEFINE_STATIC_LOCAL(Vector<StyleDashboardRegion>, emptyList, ());
     return emptyList;
 }
 
 const Vector<StyleDashboardRegion>& RenderStyle::noneDashboardRegions()
 {
-    static Vector<StyleDashboardRegion> noneList;
+    DEFINE_STATIC_LOCAL(Vector<StyleDashboardRegion>, noneList, ());
     static bool noneListInitialized = false;
 
     if (!noneListInitialized) {
index 720871b..45f35e2 100644 (file)
@@ -50,6 +50,7 @@
 #include "SQLResultSet.h"
 #include <runtime/InitializeThreading.h>
 #include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -58,31 +59,33 @@ static Mutex& guidMutex()
     // Note: We don't have to use AtomicallyInitializedStatic here because
     // this function is called once in the constructor on the main thread
     // before any other threads that call this function are used.
-    static Mutex& mutex = *new Mutex;
+    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
     return mutex;
 }
 
-static HashMap<int, String>& guidToVersionMap()
+typedef HashMap<int, String> GuidVersionMap;
+static GuidVersionMap& guidToVersionMap()
 {
-    static HashMap<int, String>& map = *new HashMap<int, String>;
+    DEFINE_STATIC_LOCAL(GuidVersionMap, map, ());
     return map;
 }
 
-static HashMap<int, HashSet<Database*>*>& guidToDatabaseMap()
+typedef HashMap<int, HashSet<Database*>*> GuidDatabaseMap;
+static GuidDatabaseMap& guidToDatabaseMap()
 {
-    static HashMap<int, HashSet<Database*>*>& map = *new HashMap<int, HashSet<Database*>*>;
+    DEFINE_STATIC_LOCAL(GuidDatabaseMap, map, ());
     return map;
 }
 
 const String& Database::databaseInfoTableName()
 {
-    static String& name = *new String("__WebKitDatabaseInfoTable__");
+    DEFINE_STATIC_LOCAL(String, name, ("__WebKitDatabaseInfoTable__"));
     return name;
 }
 
 static const String& databaseVersionKey()
 {
-    static String& key = *new String("WebKitDatabaseVersionKey");
+    DEFINE_STATIC_LOCAL(String, key, ("WebKitDatabaseVersionKey"));
     return key;
 }
 
@@ -218,7 +221,7 @@ static bool retrieveTextResultFromDatabase(SQLiteDatabase& db, const String& que
 
 bool Database::getVersionFromDatabase(String& version)
 {
-    static String& getVersionQuery = *new String("SELECT value FROM " + databaseInfoTableName() + " WHERE key = '" + databaseVersionKey() + "';");
+    DEFINE_STATIC_LOCAL(String, getVersionQuery, ("SELECT value FROM " + databaseInfoTableName() + " WHERE key = '" + databaseVersionKey() + "';"));
 
     m_databaseAuthorizer->disable();
 
@@ -254,7 +257,7 @@ static bool setTextValueInDatabase(SQLiteDatabase& db, const String& query, cons
 
 bool Database::setVersionInDatabase(const String& version)
 {
-    static String& setVersionQuery = *new String("INSERT INTO " + databaseInfoTableName() + " (key, value) VALUES ('" + databaseVersionKey() + "', ?);");
+    DEFINE_STATIC_LOCAL(String, setVersionQuery, ("INSERT INTO " + databaseInfoTableName() + " (key, value) VALUES ('" + databaseVersionKey() + "', ?);"));
 
     m_databaseAuthorizer->disable();
 
@@ -363,9 +366,10 @@ static int guidForOriginAndName(const String& origin, const String& name)
     // Note: We don't have to use AtomicallyInitializedStatic here because
     // this function is called once in the constructor on the main thread
     // before any other threads that call this function are used.
-    static Mutex& stringIdentifierMutex = *new Mutex;
+    DEFINE_STATIC_LOCAL(Mutex, stringIdentifierMutex, ());
     MutexLocker locker(stringIdentifierMutex);
-    static HashMap<String, int>& stringIdentifierToGUIDMap = *new HashMap<String, int>;
+    typedef HashMap<String, int> IDGuidMap;
+    DEFINE_STATIC_LOCAL(IDGuidMap, stringIdentifierToGUIDMap, ());
     int guid = stringIdentifierToGUIDMap.get(stringID);
     if (!guid) {
         static int currentNewGUID = 1;
index 4805d0e..d139283 100644 (file)
@@ -41,6 +41,7 @@
 #include "SecurityOriginHash.h"
 #include "SQLiteStatement.h"
 #include <wtf/MainThread.h>
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -55,7 +56,7 @@ OriginQuotaManager& DatabaseTracker::originQuotaManager()
 
 DatabaseTracker& DatabaseTracker::tracker()
 {
-    static DatabaseTracker& tracker = *new DatabaseTracker;
+    DEFINE_STATIC_LOCAL(DatabaseTracker, tracker, ());
     return tracker;
 }
 
@@ -771,7 +772,7 @@ void DatabaseTracker::setClient(DatabaseTrackerClient* client)
 
 static Mutex& notificationMutex()
 {
-    static Mutex& mutex = *new Mutex;
+    DEFINE_STATIC_LOCAL(Mutex, mutex, ());
     return mutex;
 }
 
@@ -779,7 +780,7 @@ typedef Vector<pair<SecurityOrigin*, String> > NotificationQueue;
 
 static NotificationQueue& notificationQueue()
 {
-    static NotificationQueue& queue = *new NotificationQueue;
+    DEFINE_STATIC_LOCAL(NotificationQueue, queue, ());
     return queue;
 }
 
index 0177593..37841be 100644 (file)
@@ -35,6 +35,7 @@
 #include "Page.h"
 #include "PageGroup.h"
 #include "StorageArea.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -42,7 +43,7 @@ typedef HashMap<String, LocalStorage*> LocalStorageMap;
 
 static LocalStorageMap& localStorageMap()
 {
-    static LocalStorageMap localStorageMap;
+    DEFINE_STATIC_LOCAL(LocalStorageMap, localStorageMap, ());
     return localStorageMap;
 }
 
index 60ffc47..4beb520 100644 (file)
@@ -32,6 +32,7 @@
 #include "SVGPathElement.h"
 #include "SVGTransformList.h"
 #include <math.h>
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
     
@@ -91,8 +92,8 @@ void SVGAnimateMotionElement::parseMappedAttribute(MappedAttribute* attr)
     
 SVGAnimateMotionElement::RotateMode SVGAnimateMotionElement::rotateMode() const
 {
-    static const AtomicString autoVal("auto");
-    static const AtomicString autoReverse("auto-reverse");
+    DEFINE_STATIC_LOCAL(const AtomicString, autoVal, ("auto"));
+    DEFINE_STATIC_LOCAL(const AtomicString, autoReverse, ("auto-reverse"));
     String rotate = getAttribute(SVGNames::rotateAttr);
     if (rotate == autoVal)
         return RotateAuto;
index 5910ac8..2a39828 100644 (file)
@@ -40,6 +40,7 @@
 #include "SVGUseElement.h"
 #include "XLinkNames.h"
 #include <math.h>
+#include <wtf/StdLibExtras.h>
 
 using namespace std;
 
@@ -196,10 +197,10 @@ SVGAnimationElement::AnimationMode SVGAnimationElement::animationMode() const
 
 SVGAnimationElement::CalcMode SVGAnimationElement::calcMode() const
 {    
-    static const AtomicString discrete("discrete");
-    static const AtomicString linear("linear");
-    static const AtomicString paced("paced");
-    static const AtomicString spline("spline");
+    DEFINE_STATIC_LOCAL(const AtomicString, discrete, ("discrete"));
+    DEFINE_STATIC_LOCAL(const AtomicString, linear, ("linear"));
+    DEFINE_STATIC_LOCAL(const AtomicString, paced, ("paced"));
+    DEFINE_STATIC_LOCAL(const AtomicString, spline, ("spline"));
     const AtomicString& value = getAttribute(SVGNames::calcModeAttr);
     if (value == discrete)
         return CalcModeDiscrete;
@@ -214,8 +215,8 @@ SVGAnimationElement::CalcMode SVGAnimationElement::calcMode() const
 
 SVGAnimationElement::AttributeType SVGAnimationElement::attributeType() const
 {    
-    static const AtomicString css("CSS");
-    static const AtomicString xml("XML");
+    DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS"));
+    DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML"));
     const AtomicString& value = getAttribute(SVGNames::attributeTypeAttr);
     if (value == css)
         return AttributeTypeCSS;
@@ -241,14 +242,14 @@ String SVGAnimationElement::fromValue() const
 
 bool SVGAnimationElement::isAdditive() const
 {
-    static const AtomicString sum("sum");
+    DEFINE_STATIC_LOCAL(const AtomicString, sum, ("sum"));
     const AtomicString& value = getAttribute(SVGNames::additiveAttr);
     return value == sum || animationMode() == ByAnimation;
 }
 
 bool SVGAnimationElement::isAccumulated() const
 {
-    static const AtomicString sum("sum");
+    DEFINE_STATIC_LOCAL(const AtomicString, sum, ("sum"));
     const AtomicString& value = getAttribute(SVGNames::accumulateAttr);
     return value == sum && animationMode() != ToAnimation;
 }
index 638f0c1..099934d 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "SVGElement.h"
 #include "XMLNames.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -51,7 +52,7 @@ void SVGLangSpace::setXmllang(const AtomicString& xmlLang)
 const AtomicString& SVGLangSpace::xmlspace() const
 {
     if (!m_space) {
-        static const AtomicString defaultString("default");
+        DEFINE_STATIC_LOCAL(const AtomicString, defaultString, ("default"));
         return defaultString;
     }
 
index 6875ab8..92a1de2 100644 (file)
@@ -47,6 +47,7 @@
 #include "SVGZoomEvent.h"
 #include "SelectionController.h"
 #include "SMILTimeContainer.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -89,7 +90,7 @@ SVGSVGElement::~SVGSVGElement()
 
 const AtomicString& SVGSVGElement::contentScriptType() const
 {
-    static const AtomicString defaultValue("text/ecmascript");
+    DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/ecmascript"));
     const AtomicString& n = getAttribute(contentScriptTypeAttr);
     return n.isNull() ? defaultValue : n;
 }
@@ -101,7 +102,7 @@ void SVGSVGElement::setContentScriptType(const AtomicString& type)
 
 const AtomicString& SVGSVGElement::contentStyleType() const
 {
-    static const AtomicString defaultValue("text/css");
+    DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/css"));
     const AtomicString& n = getAttribute(contentStyleTypeAttr);
     return n.isNull() ? defaultValue : n;
 }
index 2612de0..c69b547 100644 (file)
@@ -30,6 +30,7 @@
 #include "ExceptionCode.h"
 #include "HTMLNames.h"
 #include "XMLNames.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -53,7 +54,7 @@ void SVGStyleElement::setXmlspace(const AtomicString&, ExceptionCode& ec)
 
 const AtomicString& SVGStyleElement::type() const
 {
-    static const AtomicString defaultValue("text/css");
+    DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/css"));
     const AtomicString& n = getAttribute(typeAttr);
     return n.isNull() ? defaultValue : n;
 }
@@ -65,7 +66,7 @@ void SVGStyleElement::setType(const AtomicString&, ExceptionCode& ec)
 
 const AtomicString& SVGStyleElement::media() const
 {
-    static const AtomicString defaultValue("all");
+    DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("all"));
     const AtomicString& n = getAttribute(mediaAttr);
     return n.isNull() ? defaultValue : n;
 }
index e53d662..61819ee 100644 (file)
@@ -38,6 +38,7 @@
 #include "SVGInlineTextBox.h"
 #include "SVGNames.h"
 #include "XMLNames.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -498,7 +499,7 @@ void SVGTextContentElement::parseMappedAttribute(MappedAttribute* attr)
             return;
         if (SVGLangSpace::parseMappedAttribute(attr)) {
             if (attr->name().matches(XMLNames::spaceAttr)) {
-                static const AtomicString preserveString("preserve");
+                DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve"));
 
                 if (attr->value() == preserveString)
                     addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePre);
index a07a407..4aa281a 100644 (file)
@@ -42,6 +42,7 @@
 #include "XLinkNames.h"
 #include <math.h>
 #include <wtf/MathExtras.h>
+#include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
 using namespace std;
@@ -193,7 +194,7 @@ SMILTime SVGSMILElement::parseClockValue(const String& data)
     
     String parse = data.stripWhiteSpace();
 
-    static const AtomicString indefiniteValue("indefinite");
+    DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite"));
     if (parse == indefiniteValue)
         return SMILTime::indefinite();
 
@@ -457,8 +458,8 @@ bool SVGSMILElement::isFrozen() const
     
 SVGSMILElement::Restart SVGSMILElement::restart() const
 {    
-    static const AtomicString never("never");
-    static const AtomicString whenNotActive("whenNotActive");
+    DEFINE_STATIC_LOCAL(const AtomicString, never, ("never"));
+    DEFINE_STATIC_LOCAL(const AtomicString, whenNotActive, ("whenNotActive"));
     const AtomicString& value = getAttribute(SVGNames::restartAttr);
     if (value == never)
         return RestartNever;
@@ -469,7 +470,7 @@ SVGSMILElement::Restart SVGSMILElement::restart() const
     
 SVGSMILElement::FillMode SVGSMILElement::fill() const
 {   
-    static const AtomicString freeze("freeze");
+    DEFINE_STATIC_LOCAL(const AtomicString, freeze, ("freeze"));
     const AtomicString& value = getAttribute(SVGNames::fillAttr);
     return value == freeze ? FillFreeze : FillRemove;
 }
@@ -506,7 +507,7 @@ SMILTime SVGSMILElement::repeatCount() const
     if (value.isNull())
         return SMILTime::unresolved();
 
-    static const AtomicString indefiniteValue("indefinite");
+    DEFINE_STATIC_LOCAL(const AtomicString, indefiniteValue, ("indefinite"));
     if (value == indefiniteValue)
         return SMILTime::indefinite();
     bool ok;
@@ -861,7 +862,7 @@ void SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement)
 void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOrExisting)
 {
     ASSERT(m_intervalBegin.isFinite());
-    static HashSet<SVGSMILElement*> loopBreaker;
+    DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ());
     if (loopBreaker.contains(this))
         return;
     loopBreaker.add(this);
index 10d6648..82c10ba 100644 (file)
@@ -31,6 +31,7 @@
 #include "RenderPath.h"
 #include "SVGElement.h"
 #include "SVGStyledElement.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -47,8 +48,10 @@ struct ResourceSet {
     SVGResource* resources[_ResourceTypeCount]; 
 };
 
-static HashMap<SVGStyledElement*, ResourceSet*>& clientMap() {
-    static HashMap<SVGStyledElement*, ResourceSet*> map;
+typedef HashMap<SVGStyledElement*, ResourceSet*> ResourceClientMap;
+
+static ResourceClientMap& clientMap() {
+    DEFINE_STATIC_LOCAL(ResourceClientMap, map, ());
     return map;
 }
 
@@ -116,7 +119,7 @@ void SVGResource::invalidateClients(HashSet<SVGStyledElement*> clients)
 
 void SVGResource::removeClient(SVGStyledElement* item) 
 {
-    HashMap<SVGStyledElement*, ResourceSet*>::iterator resourcePtr = clientMap().find(item);
+    ResourceClientMap::iterator resourcePtr = clientMap().find(item);
     if (resourcePtr == clientMap().end())
         return;
     
index 3649321..24c1cdf 100644 (file)
@@ -32,6 +32,7 @@
 #include "GraphicsContext.h"
 #include "RenderSVGViewportContainer.h"
 #include "TextStream.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
@@ -65,7 +66,7 @@ void SVGResourceMarker::draw(GraphicsContext* context, const FloatRect& rect, do
     if (!m_marker)
         return;
 
-    static HashSet<SVGResourceMarker*> currentlyDrawingMarkers;
+    DEFINE_STATIC_LOCAL(HashSet<SVGResourceMarker*>, currentlyDrawingMarkers, ());
 
     // avoid drawing circular marker references
     if (currentlyDrawingMarkers.contains(this))
index 67aba0b..7130079 100644 (file)
 #include "XMLHttpRequestUpload.h"
 #include "markup.h"
 #include <runtime/JSLock.h>
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
+typedef HashSet<String, CaseFoldingHash> HeadersSet;
+
 struct PreflightResultCacheItem {
-    PreflightResultCacheItem(unsigned expiryDelta, bool credentials, HashSet<String>* methods, HashSet<String, CaseFoldingHash>* headers)
+    PreflightResultCacheItem(unsigned expiryDelta, bool credentials, HashSet<String>* methods, HeadersSet* headers)
         : m_absoluteExpiryTime(currentTime() + expiryDelta)
         , m_credentials(credentials)
         , m_methods(methods)
@@ -66,19 +69,19 @@ struct PreflightResultCacheItem {
     double m_absoluteExpiryTime;
     bool m_credentials;
     OwnPtr<HashSet<String> > m_methods;
-    OwnPtr<HashSet<String, CaseFoldingHash> > m_headers;
+    OwnPtr<HeadersSet > m_headers;
 };
 
 typedef HashMap<std::pair<String, KURL>, PreflightResultCacheItem*> PreflightResultCache;
 
 static PreflightResultCache& preflightResultCache()
 {
-    static PreflightResultCache cache;
+    DEFINE_STATIC_LOCAL(PreflightResultCache, cache, ());
     return cache;
 }
 
 static void appendPreflightResultCacheEntry(String origin, KURL url, unsigned expiryDelta, 
-                                            bool credentials, HashSet<String>* methods, HashSet<String, CaseFoldingHash>* headers)
+                                            bool credentials, HashSet<String>* methods, HeadersSet* headers)
 {
     ASSERT(!preflightResultCache().contains(std::make_pair(origin, url)));
 
@@ -88,9 +91,9 @@ static void appendPreflightResultCacheEntry(String origin, KURL url, unsigned ex
 
 static bool isSafeRequestHeader(const String& name)
 {
-    static HashSet<String, CaseFoldingHash> forbiddenHeaders;
-    static String proxyString("proxy-");
-    static String secString("sec-");
+    DEFINE_STATIC_LOCAL(HeadersSet, forbiddenHeaders, ());
+    DEFINE_STATIC_LOCAL(String, proxyString, ("proxy-"));
+    DEFINE_STATIC_LOCAL(String, secString, ("sec-"));
     
     if (forbiddenHeaders.isEmpty()) {
         forbiddenHeaders.add("accept-charset");
@@ -121,7 +124,7 @@ static bool isOnAccessControlSimpleRequestHeaderWhitelist(const String& name)
 
 static bool isOnAccessControlResponseHeaderWhitelist(const String& name)
 {
-    static HashSet<String, CaseFoldingHash> allowedHeaders;
+    DEFINE_STATIC_LOCAL(HeadersSet, allowedHeaders, ());
     if (allowedHeaders.isEmpty()) {
         allowedHeaders.add("cache-control");
         allowedHeaders.add("content-language");
@@ -1165,7 +1168,7 @@ void XMLHttpRequest::didReceiveResponsePreflight(SubresourceLoader*, const Resou
         return;
     }
 
-    OwnPtr<HashSet<String, CaseFoldingHash> > headers(new HashSet<String, CaseFoldingHash>);
+    OwnPtr<HeadersSet > headers(new HeadersSet);
     if (!parseAccessControlAllowList(response.httpHeaderField("Access-Control-Allow-Headers"), headers.get())) {
         networkError();
         return;
index 88e349e..647c6af 100644 (file)
 
 #include "Node.h"
 #include "XPathValue.h"
+#include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 namespace XPath {
     
 EvaluationContext& Expression::evaluationContext()
 {
-    static EvaluationContext evaluationContext;
+    DEFINE_STATIC_LOCAL(EvaluationContext, evaluationContext, ());
     return evaluationContext;
 }
 
index 77c3011..5501df1 100644 (file)
@@ -36,6 +36,7 @@
 #include "XPathException.h"
 #include "XPathNSResolver.h"
 #include "XPathStep.h"
+#include <wtf/StdLibExtras.h>
 
 int xpathyyparse(void*);
 
@@ -53,6 +54,8 @@ Parser* Parser::currentParser = 0;
     
 enum XMLCat { NameStart, NameCont, NotPartOfName };
 
+typedef HashMap<String, Step::Axis> AxisNamesMap;
+
 static XMLCat charCat(UChar aChar)
 {
     //### might need to add some special cases from the XML spec.
@@ -70,7 +73,7 @@ static XMLCat charCat(UChar aChar)
     return NotPartOfName;
 }
 
-static void setUpAxisNamesMap(HashMap<String, Step::Axis>& axisNames)
+static void setUpAxisNamesMap(AxisNamesMap& axisNames)
 {
     struct AxisName {
         const char* name;
@@ -97,12 +100,12 @@ static void setUpAxisNamesMap(HashMap<String, Step::Axis>& axisNames)
 
 static bool isAxisName(const String& name, Step::Axis& type)
 {
-    static HashMap<String, Step::Axis> axisNames;
+    DEFINE_STATIC_LOCAL(AxisNamesMap, axisNames, ());
 
     if (axisNames.isEmpty())
         setUpAxisNamesMap(axisNames);
 
-    HashMap<String, Step::Axis>::iterator it = axisNames.find(name);
+    AxisNamesMap::iterator it = axisNames.find(name);
     if (it == axisNames.end())
         return false;
     type = it->second;
@@ -111,7 +114,7 @@ static bool isAxisName(const String& name, Step::Axis& type)
 
 static bool isNodeTypeName(const String& name)
 {
-    static HashSet<String> nodeTypeNames;
+    DEFINE_STATIC_LOCAL(HashSet<String>, nodeTypeNames, ());
     if (nodeTypeNames.isEmpty()) {
         nodeTypeNames.add("comment");
         nodeTypeNames.add("text");
index b3cad38..bac0e13 100644 (file)
@@ -33,6 +33,7 @@
 #include "XPathUtil.h"
 
 #include <wtf/MathExtras.h>
+#include <wtf/StdLibExtras.h>
 #include <limits>
 
 using std::numeric_limits;
@@ -45,7 +46,7 @@ const Value::AdoptTag Value::adopt = {};
 const NodeSet& Value::toNodeSet() const
 {
     if (!m_data) {
-        static NodeSet emptyNodeSet;
+        DEFINE_STATIC_LOCAL(NodeSet, emptyNodeSet, ());
         return emptyNodeSet;
     }