Disabled caching for encoders since they hold states, bug 48284, r=cata,ftang.
This commit is contained in:
Родитель
b3a13bef5a
Коммит
60ce8b12d8
|
@ -46,7 +46,7 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||||
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
|
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
|
||||||
static NS_DEFINE_CID(kSupportsArrayCID, NS_SUPPORTSARRAY_CID);
|
static NS_DEFINE_CID(kSupportsArrayCID, NS_SUPPORTSARRAY_CID);
|
||||||
|
|
||||||
// Pattern of cached, commonly used, single byte encoder and decoder
|
// Pattern of cached, commonly used, single byte decoder
|
||||||
#define NS_1BYTE_CODER_PATTERN "ISO-8859"
|
#define NS_1BYTE_CODER_PATTERN "ISO-8859"
|
||||||
#define NS_1BYTE_CODER_PATTERN_LEN 8
|
#define NS_1BYTE_CODER_PATTERN_LEN 8
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -485,15 +485,8 @@ NS_IMETHODIMP nsCharsetConverterManager::GetUnicodeEncoder(
|
||||||
aDest->ToCString(progid + baselen, 256 - baselen);
|
aDest->ToCString(progid + baselen, 256 - baselen);
|
||||||
|
|
||||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||||
if (!strncmp(progid+baselen, NS_1BYTE_CODER_PATTERN, NS_1BYTE_CODER_PATTERN_LEN))
|
// Always create an instance since encoders hold state.
|
||||||
{
|
encoder = do_CreateInstance(progid, &res);
|
||||||
// Single byte encoders/decoders dont hold state. Optimize by using a service.
|
|
||||||
encoder = do_GetService(progid, &res);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
encoder = do_CreateInstance(progid, &res);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NS_FAILED(res))
|
if (NS_FAILED(res))
|
||||||
res = NS_ERROR_UCONV_NOCONV;
|
res = NS_ERROR_UCONV_NOCONV;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче