WebPreferencesStore: use DEFINE_STATIC_LOCAL for overrides HashMap
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 17:54:08 +0000 (17:54 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 17:54:08 +0000 (17:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77109

Reviewed by Andreas Kling.

Fix build for Clang.

* Shared/WebPreferencesStore.cpp:
(WebKit):
(WebKit::boolTestRunnerOverridesMap):
(WebKit::WebPreferencesStore::overrideBoolValueForKey):
(WebKit::WebPreferencesStore::removeTestRunnerOverrides):
(WebKit::WebPreferencesStore::getBoolValueForKey):

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesStore.cpp

index eead2cb..f22afe0 100644 (file)
@@ -1,5 +1,21 @@
 2012-01-26  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
+        WebPreferencesStore: use DEFINE_STATIC_LOCAL for overrides HashMap
+        https://bugs.webkit.org/show_bug.cgi?id=77109
+
+        Reviewed by Andreas Kling.
+
+        Fix build for Clang.
+
+        * Shared/WebPreferencesStore.cpp:
+        (WebKit):
+        (WebKit::boolTestRunnerOverridesMap):
+        (WebKit::WebPreferencesStore::overrideBoolValueForKey):
+        (WebKit::WebPreferencesStore::removeTestRunnerOverrides):
+        (WebKit::WebPreferencesStore::getBoolValueForKey):
+
+2012-01-26  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
         Implement overridePreference for boolean preferences in WebKitTestRunner
         https://bugs.webkit.org/show_bug.cgi?id=77033
 
index 1e4bb05..8668bec 100644 (file)
@@ -47,8 +47,13 @@ namespace WebPreferencesKey {
 
 } // namespace WebPreferencesKey
 
+typedef HashMap<String, bool> BoolOverridesMap;
 
-static HashMap<String, bool> boolTestRunnerOverridesMap;
+static BoolOverridesMap& boolTestRunnerOverridesMap()
+{
+    DEFINE_STATIC_LOCAL(BoolOverridesMap, map, ());
+    return map;
+}
 
 WebPreferencesStore::WebPreferencesStore()
 {
@@ -77,12 +82,12 @@ bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferenc
 
 void WebPreferencesStore::overrideBoolValueForKey(const String& key, bool value)
 {
-    boolTestRunnerOverridesMap.set(key, value);
+    boolTestRunnerOverridesMap().set(key, value);
 }
 
 void WebPreferencesStore::removeTestRunnerOverrides()
 {
-    boolTestRunnerOverridesMap.clear();
+    boolTestRunnerOverridesMap().clear();
 }
 
 
@@ -180,8 +185,8 @@ bool WebPreferencesStore::setBoolValueForKey(const String& key, bool value)
 bool WebPreferencesStore::getBoolValueForKey(const String& key) const
 {
     // FIXME: Extend overriding to other key types used from LayoutTestController.
-    HashMap<String, bool>::const_iterator it = boolTestRunnerOverridesMap.find(key);
-    if (it != boolTestRunnerOverridesMap.end())
+    BoolOverridesMap::const_iterator it = boolTestRunnerOverridesMap().find(key);
+    if (it != boolTestRunnerOverridesMap().end())
         return it->second;
     return valueForKey(m_boolValues, key);
 }