Closed
Bug 123699
Opened 23 years ago
Closed 23 years ago
Cache MIME converter in nsMsgI18N.cpp
Categories
(MailNews Core :: Internationalization, defect)
MailNews Core
Internationalization
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla0.9.9
People
(Reporter: nhottanscp, Assigned: nhottanscp)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
mscott
:
superreview+
|
Details | Diff | Splinter Review |
nsMsgI18NEncodeMimePartIIStr creates the converter object everytime it's called.
That can be cached and released at shutdown.
http://lxr.mozilla.org/seamonkey/source/mailnews/base/util/nsMsgI18N.cpp#399
Assignee | ||
Updated•23 years ago
|
Assignee | ||
Comment 1•23 years ago
|
||
Assignee | ||
Comment 2•23 years ago
|
||
Attachment #68036 -
Attachment is obsolete: true
Comment 3•23 years ago
|
||
Is this thread-safe?
Assignee | ||
Comment 4•23 years ago
|
||
The threading issue seems to be okay since the Mime Converter only lives on the
UI thread.
But I need to find a way to remove the shutdown observer.
Assignee | ||
Comment 5•23 years ago
|
||
It turned out that I don't need to remove it, it is taken care by XPCOM.
Comment 6•23 years ago
|
||
Comment on attachment 68056 [details] [diff] [review]
Cache MIME converter and added MIME decoder function.
looks good. R=ducarroz
Comment 7•23 years ago
|
||
They are exposed to public. Even though it's used by UI thread only today,
it may be used by someone else tomorrow. At least, it must have a mutex to
block multiple calls.
A better implementation would cache multiple instances of converter
so that blocking won't occur until number of concurrent calls reaches
the number of cached instances.
Comment 8•23 years ago
|
||
Comment on attachment 68056 [details] [diff] [review]
Cache MIME converter and added MIME decoder function.
Naoki, why don't we just invoke the MimeConverter as a service directly in your
I18n util routines (nsMsgI18NDecoderMimePartIIStr and the routine above it).
If you invoke it as a service, we will only create one instance of the object
and we'll cache it, always re-using that same instance.
This way, you let the service manager manage the life time of your decoder
object. Then you can remove your static global variable, your class which
becomes an xpcom shutdown observer just so you can release your class, and your
InitializeMsgI18NGlobals routine.
The service manager does all of that for you already. That would reduce your
patch to just a couple lines I think.
Assignee | ||
Comment 9•23 years ago
|
||
I agree, mark this as WONTFIX.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Comment 10•23 years ago
|
||
why is this a won't fix? You still need a patch that invokes the decoder as a
service for these two routines. Shouldn't that patch go in this bug?
Assignee | ||
Comment 11•23 years ago
|
||
I forgot that there is an existing code for the encoder. I am going to change it
to use a service. For decoder, the client can get a service by itself, so I
won't add the function.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Assignee | ||
Comment 12•23 years ago
|
||
Attachment #68056 -
Attachment is obsolete: true
Comment 13•23 years ago
|
||
Comment on attachment 69317 [details] [diff] [review]
Change to use the service manager for mime converter.
sr=mscott
Attachment #69317 -
Flags: superreview+
Comment 14•23 years ago
|
||
Comment on attachment 69317 [details] [diff] [review]
Change to use the service manager for mime converter.
oops one little comment. the component manager will return an error if it
couldn't create a mime converter so you don't need the nsnull != converter
if you leave it, just do
NS_SUCCEEDED(res) && converter which is much easier to read than the null
comparison.
Assignee | ||
Comment 15•23 years ago
|
||
checked in
Status: REOPENED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: MailNews → Core
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•