diff options
Diffstat (limited to 'intl')
20 files changed, 29 insertions, 31 deletions
diff --git a/intl/strres/nsStringBundle.cpp b/intl/strres/nsStringBundle.cpp index ab840a469..717e368e2 100644 --- a/intl/strres/nsStringBundle.cpp +++ b/intl/strres/nsStringBundle.cpp @@ -25,6 +25,7 @@ #include "nsIErrorService.h" #include "nsICategoryManager.h" #include "nsContentUtils.h" +#include "mozilla/Preferences.h" // for async loading #ifdef ASYNC_LOADING @@ -32,6 +33,9 @@ #include "nsIStringStream.h" #endif +#define STR_HELPER(x) #x +#define STR(x) STR_HELPER(x) + using namespace mozilla; static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID); @@ -529,6 +533,8 @@ nsStringBundleService::Init() os->AddObserver(this, "profile-do-change", true); os->AddObserver(this, "chrome-flush-caches", true); os->AddObserver(this, "xpcom-category-entry-added", true); + os->AddObserver(this, "selected-locale-has-changed", true); + os->AddObserver(this, "final-ui-startup", true); } // instantiate the override service, if there is any. @@ -550,6 +556,19 @@ nsStringBundleService::Observe(nsISupports* aSubject, { flushBundleCache(); } + else if (strcmp("selected-locale-has-changed", aTopic) == 0) + { + flushBundleCache(); + notifyBundlesFlushed(); + } + else if (strcmp("final-ui-startup", aTopic) == 0) + { + nsAdoptingCString ualocale = Preferences::GetCString("general.useragent.locale"); + if (!ualocale.EqualsLiteral(STR(MOZ_UI_LOCALE))) { + flushBundleCache(); + notifyBundlesFlushed(); + } + } else if (strcmp("xpcom-category-entry-added", aTopic) == 0 && NS_LITERAL_STRING("xpcom-autoregistration").Equals(aSomeData)) { @@ -560,6 +579,14 @@ nsStringBundleService::Observe(nsISupports* aSubject, } void +nsStringBundleService::notifyBundlesFlushed() +{ + nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); + NS_ASSERTION(obsSvc, "Couldn't get observer service."); + obsSvc->NotifyObservers(nullptr, "string-bundles-have-flushed", nullptr); +} + +void nsStringBundleService::flushBundleCache() { // release all bundles in the cache diff --git a/intl/strres/nsStringBundleService.h b/intl/strres/nsStringBundleService.h index a192cdff8..e65c61f12 100644 --- a/intl/strres/nsStringBundleService.h +++ b/intl/strres/nsStringBundleService.h @@ -43,6 +43,8 @@ private: void flushBundleCache(); + void notifyBundlesFlushed(); + bundleCacheEntry_t *insertIntoCache(already_AddRefed<nsIStringBundle> aBundle, nsCString &aHashKey); diff --git a/intl/uconv/ucvja/nsJapaneseToUnicode.h b/intl/uconv/ucvja/nsJapaneseToUnicode.h index 8e3f207eb..e2ea45fb6 100644 --- a/intl/uconv/ucvja/nsJapaneseToUnicode.h +++ b/intl/uconv/ucvja/nsJapaneseToUnicode.h @@ -83,8 +83,6 @@ public: mGB2312Decoder = nullptr; mEUCKRDecoder = nullptr; mISO88597Decoder = nullptr; - mozilla::Telemetry::Accumulate( - mozilla::Telemetry::DECODER_INSTANTIATED_ISO2022JP, true); } virtual ~nsISO2022JPToUnicodeV2() { diff --git a/intl/uconv/ucvlatin/nsCP866ToUnicode.cpp b/intl/uconv/ucvlatin/nsCP866ToUnicode.cpp index 4d4b89948..08db5f65a 100644 --- a/intl/uconv/ucvlatin/nsCP866ToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsCP866ToUnicode.cpp @@ -20,7 +20,6 @@ nsCP866ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "cp866.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_IBM866, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsISO88595ToUnicode.cpp b/intl/uconv/ucvlatin/nsISO88595ToUnicode.cpp index 23395aa4e..dae79881d 100644 --- a/intl/uconv/ucvlatin/nsISO88595ToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsISO88595ToUnicode.cpp @@ -20,7 +20,6 @@ nsISO88595ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "8859-5.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_ISO_8859_5, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsKOI8RToUnicode.cpp b/intl/uconv/ucvlatin/nsKOI8RToUnicode.cpp index 35f77ba41..25a760a66 100644 --- a/intl/uconv/ucvlatin/nsKOI8RToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsKOI8RToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsKOI8RToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsKOI8RToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "koi8r.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_KOI8R, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsKOI8UToUnicode.cpp b/intl/uconv/ucvlatin/nsKOI8UToUnicode.cpp index c5d588ad6..2dbb86377 100644 --- a/intl/uconv/ucvlatin/nsKOI8UToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsKOI8UToUnicode.cpp @@ -20,7 +20,6 @@ nsKOI8UToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "koi8u.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_KOI8U, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacArabicToUnicode.cpp b/intl/uconv/ucvlatin/nsMacArabicToUnicode.cpp index 1a9950df7..7ff51f868 100644 --- a/intl/uconv/ucvlatin/nsMacArabicToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacArabicToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacArabicToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacArabicToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macarabic.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACARABIC, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacCEToUnicode.cpp b/intl/uconv/ucvlatin/nsMacCEToUnicode.cpp index 458d0f53c..4dd3eb159 100644 --- a/intl/uconv/ucvlatin/nsMacCEToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacCEToUnicode.cpp @@ -20,7 +20,6 @@ nsMacCEToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macce.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACCE, true); return CreateOneByteDecoder((uMappingTable*) &g_MacCEMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacCroatianToUnicode.cpp b/intl/uconv/ucvlatin/nsMacCroatianToUnicode.cpp index 9799ac9ad..a0549ee26 100644 --- a/intl/uconv/ucvlatin/nsMacCroatianToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacCroatianToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacCroatianToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacCroatianToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "maccroat.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACCROATIAN, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacCyrillicToUnicode.cpp b/intl/uconv/ucvlatin/nsMacCyrillicToUnicode.cpp index edbf604fd..0475c2a13 100644 --- a/intl/uconv/ucvlatin/nsMacCyrillicToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacCyrillicToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacCyrillicToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacCyrillicToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "maccyril.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACCYRILLIC, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacDevanagariToUnicode.cpp b/intl/uconv/ucvlatin/nsMacDevanagariToUnicode.cpp index 3c1cae733..630553d9c 100644 --- a/intl/uconv/ucvlatin/nsMacDevanagariToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacDevanagariToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacDevanagariToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacDevanagariToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macdevanaga.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACDEVANAGARI, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacFarsiToUnicode.cpp b/intl/uconv/ucvlatin/nsMacFarsiToUnicode.cpp index 1e7e291ba..5870533ff 100644 --- a/intl/uconv/ucvlatin/nsMacFarsiToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacFarsiToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacFarsiToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacFarsiToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macfarsi.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACFARSI, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacGreekToUnicode.cpp b/intl/uconv/ucvlatin/nsMacGreekToUnicode.cpp index 3f90811d3..64d489147 100644 --- a/intl/uconv/ucvlatin/nsMacGreekToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacGreekToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacGreekToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacGreekToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macgreek.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACGREEK, true); return CreateOneByteDecoder((uMappingTable*) &g_MacGreekMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacGujaratiToUnicode.cpp b/intl/uconv/ucvlatin/nsMacGujaratiToUnicode.cpp index 21b3020f5..0d01e33e4 100644 --- a/intl/uconv/ucvlatin/nsMacGujaratiToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacGujaratiToUnicode.cpp @@ -17,7 +17,6 @@ nsMacGujaratiToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macgujarati.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACGUJARATI, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacGurmukhiToUnicode.cpp b/intl/uconv/ucvlatin/nsMacGurmukhiToUnicode.cpp index d6b3a88d6..e0a59c205 100644 --- a/intl/uconv/ucvlatin/nsMacGurmukhiToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacGurmukhiToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacGurmukhiToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacGurmukhiToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macgurmukhi.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACGURMUKHI, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacHebrewToUnicode.cpp b/intl/uconv/ucvlatin/nsMacHebrewToUnicode.cpp index f19d82c09..d7b1f2139 100644 --- a/intl/uconv/ucvlatin/nsMacHebrewToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacHebrewToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacHebrewToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacHebrewToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "machebrew.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACHEBREW, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacIcelandicToUnicode.cpp b/intl/uconv/ucvlatin/nsMacIcelandicToUnicode.cpp index 00cff7509..2b2a3b4d0 100644 --- a/intl/uconv/ucvlatin/nsMacIcelandicToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacIcelandicToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacIcelandicToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacIcelandicToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macicela.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACICELANDIC, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacRomanianToUnicode.cpp b/intl/uconv/ucvlatin/nsMacRomanianToUnicode.cpp index 96c24dea3..955610e16 100644 --- a/intl/uconv/ucvlatin/nsMacRomanianToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacRomanianToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacRomanianToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacRomanianToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macro.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACROMANIAN, true); return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable, aOuter, aIID, aResult); } diff --git a/intl/uconv/ucvlatin/nsMacTurkishToUnicode.cpp b/intl/uconv/ucvlatin/nsMacTurkishToUnicode.cpp index 86d2d1ae7..c30cf94d4 100644 --- a/intl/uconv/ucvlatin/nsMacTurkishToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsMacTurkishToUnicode.cpp @@ -5,7 +5,6 @@ #include "nsUCConstructors.h" #include "nsMacTurkishToUnicode.h" -#include "mozilla/Telemetry.h" using namespace mozilla; @@ -20,7 +19,6 @@ nsMacTurkishToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, #include "macturki.ut" }; - Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_MACTURKISH, true); return CreateOneByteDecoder((uMappingTable*) &g_MacTurkishMappingTable, aOuter, aIID, aResult); } |