Kaydet (Commit) 3acc0cc1 authored tarafından Eike Rathke's avatar Eike Rathke

moved LANGUAGE_DONTKNOW impl detection up

Change-Id: Iba2c7f03420a709c5ee6338c1504b1133a8cb643
üst 745f5945
......@@ -698,17 +698,37 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
if (mbInitializedLangID)
{
// A great share are calls for a system equal locale.
pImpl = theSystemLocale::get();
if (pImpl && pImpl->mnLangID == mnLangID)
if (mnLangID == LANGUAGE_DONTKNOW)
{
// Heavy usage of LANGUAGE_DONTKNOW, make it an own Impl for all the
// conversion attempts. At the same time provide a central breakpoint
// to inspect such places.
LanguageTag::ImplPtr& rDontKnow = theDontKnow::get();
if (!rDontKnow)
rDontKnow.reset( new LanguageTagImpl( *this));
pImpl = rDontKnow;
#if OSL_DEBUG_LEVEL > 0
static size_t nCallsSystemEqual = 0;
++nCallsSystemEqual;
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsSystemEqual << " system equal LangID calls");
static size_t nCallsDontKnow = 0;
++nCallsDontKnow;
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsDontKnow << " DontKnow calls");
#endif
return pImpl;
}
else
{
// A great share are calls for a system equal locale.
pImpl = theSystemLocale::get();
if (pImpl && pImpl->mnLangID == mnLangID)
{
#if OSL_DEBUG_LEVEL > 0
static size_t nCallsSystemEqual = 0;
++nCallsSystemEqual;
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsSystemEqual
<< " system equal LangID calls");
#endif
return pImpl;
}
}
}
// Force Bcp47 if not LangID.
......@@ -752,8 +772,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
#endif
// Prefer LangID map as find+insert needs less comparison work.
// Never insert LANGUAGE_DONTKNOW
if (mbInitializedLangID && mnLangID != LANGUAGE_DONTKNOW)
if (mbInitializedLangID)
{
MapLangID& rMap = theMapLangID::get();
MapLangID::const_iterator it( rMap.find( mnLangID));
......@@ -863,21 +882,6 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
}
}
}
else if (mbInitializedLangID && mnLangID == LANGUAGE_DONTKNOW)
{
// Heavy usage of LANGUAGE_DONTKNOW, make it an own Impl for all the
// conversion attempts. At the same time provide a central breakpoint
// to inspect such places.
LanguageTag::ImplPtr& rDontKnow = theDontKnow::get();
if (!rDontKnow)
rDontKnow.reset( new LanguageTagImpl( *this));
pImpl = rDontKnow;
#if OSL_DEBUG_LEVEL > 0
static size_t nCallsDontKnow = 0;
++nCallsDontKnow;
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsDontKnow << " DontKnow calls");
#endif
}
else
{
SAL_WARN( "i18nlangtag", "LanguageTag::registerImpl: can't register for 0x" << ::std::hex << mnLangID );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment