[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

aroben at apple.com aroben at apple.com
Thu Oct 29 20:48:07 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit b34b4247ba07d0d48dcbbe0f117224d3d510673d
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 19 22:00:02 2009 +0000

    Get rid of a few static initializers/exit-time destructors in WebLocalizableStrings
    
    Reviewed by Dan Bernstein.
    
    * WebLocalizableStrings.cpp:
    (mainBundleLocStrings):
    (frameworkLocStrings):
    Added these functions instead of file-scope variables.
    
    (findCachedString):
    (cacheString):
    Updated to use the new functions.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49813 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index e671816..1302a4e 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,19 @@
+2009-10-19  Adam Roben  <aroben at apple.com>
+
+        Get rid of a few static initializers/exit-time destructors in
+        WebLocalizableStrings
+
+        Reviewed by Dan Bernstein.
+
+        * WebLocalizableStrings.cpp:
+        (mainBundleLocStrings):
+        (frameworkLocStrings):
+        Added these functions instead of file-scope variables.
+
+        (findCachedString):
+        (cacheString):
+        Updated to use the new functions.
+
 2009-10-19  Nate Chapin  <japhet at chromium.org>
 
         Unreviewed, build fix.
diff --git a/WebKit/win/WebLocalizableStrings.cpp b/WebKit/win/WebLocalizableStrings.cpp
index e2da4cb..552e211 100644
--- a/WebKit/win/WebLocalizableStrings.cpp
+++ b/WebKit/win/WebLocalizableStrings.cpp
@@ -37,6 +37,7 @@
 #include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
 #include <wtf/RetainPtr.h>
+#include <wtf/StdLibExtras.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 class LocalizedString;
@@ -45,8 +46,19 @@ using namespace WebCore;
 
 WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit", 0 };
 
-static HashMap<String, LocalizedString*> mainBundleLocStrings;
-static HashMap<String, LocalizedString*> frameworkLocStrings;
+typedef HashMap<String, LocalizedString*> LocalizedStringMap;
+
+static LocalizedStringMap& mainBundleLocStrings()
+{
+    DEFINE_STATIC_LOCAL(LocalizedStringMap, map, ());
+    return map;
+}
+
+static LocalizedStringMap frameworkLocStrings()
+{
+    DEFINE_STATIC_LOCAL(LocalizedStringMap, map, ());
+    return map;
+}
 
 class LocalizedString : public Noncopyable {
 public:
@@ -157,10 +169,10 @@ static CFStringRef copyLocalizedStringFromBundle(WebLocalizableStringsBundle* st
 static LocalizedString* findCachedString(WebLocalizableStringsBundle* stringsBundle, const String& key)
 {
     if (!stringsBundle)
-        return mainBundleLocStrings.get(key);
+        return mainBundleLocStrings().get(key);
 
     if (stringsBundle->bundle == WebKitLocalizableStringsBundle.bundle)
-        return frameworkLocStrings.get(key);
+        return frameworkLocStrings().get(key);
 
     return 0;
 }
@@ -168,11 +180,11 @@ static LocalizedString* findCachedString(WebLocalizableStringsBundle* stringsBun
 static void cacheString(WebLocalizableStringsBundle* stringsBundle, const String& key, LocalizedString* value)
 {
     if (!stringsBundle) {
-        mainBundleLocStrings.set(key, value);
+        mainBundleLocStrings().set(key, value);
         return;
     }
 
-    frameworkLocStrings.set(key, value);
+    frameworkLocStrings().set(key, value);
 }
 
 static const LocalizedString& localizedString(WebLocalizableStringsBundle* stringsBundle, const String& key)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list