[WTF] Drop initializeDate
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 16:59:46 +0000 (16:59 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 16:59:46 +0000 (16:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174714

Reviewed by Darin Adler.

minYear static variable will be initialized in an exclusive manner, which is ensured by C++ "static" semantics.
Thus, we do not need to call initializeDate() explicitly.

* wtf/DateMath.cpp:
(WTF::equivalentYearForDST):
(WTF::initializeDates): Deleted.
* wtf/Threading.cpp:
(WTF::initializeThreading):

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

Source/WTF/ChangeLog
Source/WTF/wtf/DateMath.cpp
Source/WTF/wtf/Threading.cpp

index 267a056..5bffaaf 100644 (file)
@@ -1,5 +1,21 @@
 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        [WTF] Drop initializeDate
+        https://bugs.webkit.org/show_bug.cgi?id=174714
+
+        Reviewed by Darin Adler.
+
+        minYear static variable will be initialized in an exclusive manner, which is ensured by C++ "static" semantics.
+        Thus, we do not need to call initializeDate() explicitly.
+
+        * wtf/DateMath.cpp:
+        (WTF::equivalentYearForDST):
+        (WTF::initializeDates): Deleted.
+        * wtf/Threading.cpp:
+        (WTF::initializeThreading):
+
+2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         [JSC] Introduce static symbols
         https://bugs.webkit.org/show_bug.cgi?id=158863
 
index 57e24dd..32fd5c4 100644 (file)
@@ -346,7 +346,7 @@ int equivalentYearForDST(int year)
     // It is ok if the cached year is not the current year as long as the rules
     // for DST did not change between the two years; if they did the app would need
     // to be restarted.
-    static int minYear = minimumYearForDST();
+    static const int minYear { minimumYearForDST() };
     int maxYear = maximumYearForDST();
 
     int difference;
@@ -551,17 +551,6 @@ LocalTimeOffset calculateLocalTimeOffset(double ms, TimeType inputTimeType)
 #endif
 }
 
-void initializeDates()
-{
-#if !ASSERT_DISABLED
-    static bool alreadyInitialized;
-    ASSERT(!alreadyInitialized);
-    alreadyInitialized = true;
-#endif
-
-    equivalentYearForDST(2000); // Need to call once to initialize a static used in this function.
-}
-
 static inline double ymdhmsToSeconds(int year, long mon, long day, long hour, long minute, double second)
 {
     int mday = firstDayOfMonth[isLeapYear(year)][mon - 1];
index db4462a..8109b81 100644 (file)
@@ -248,7 +248,6 @@ void initializeThreading()
         ThreadHolder::initializeOnce();
         initializeRandomNumberGenerator();
         wtfThreadData();
-        initializeDates();
         Thread::initializePlatformThreading();
     });
 }