Closed
Bug 114439
Opened 23 years ago
Closed 23 years ago
nsFileTransportService should cache the mime service.
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
mozilla0.9.7
People
(Reporter: neeti, Assigned: neeti)
Details
Attachments
(4 files)
|
4.25 KB,
patch
|
Details | Diff | Splinter Review | |
|
5.09 KB,
patch
|
Details | Diff | Splinter Review | |
|
4.12 KB,
patch
|
dp
:
review+
|
Details | Diff | Splinter Review |
|
4.34 KB,
patch
|
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
Currently everytime we do a nsFileIO::Open(..), we call
do_GetService(NS_MIMESERVICE_CONTRACTID,..)
Comment 2•23 years ago
|
||
Comment on attachment 61106 [details] [diff] [review]
patch to cache mimeservice
When is the mInstance released ? If you haven't already found a way,
netwerk/build/nsNetModule.cpp has a nsNeckoShutdown when it can be released.
Comment 3•23 years ago
|
||
Comment on attachment 61106 [details] [diff] [review]
patch to cache mimeservice
nsFileTransportService::GetInstance should return a addref'ed interface
pointer.
Attachment #61106 -
Flags: needs-work+
Comment 5•23 years ago
|
||
I see trouble - nsFileTransportService::GetInstance() is being called from both
nsFileTransportService::Create() - the thing that creates the instance and from
nsFileIO::Open() - the thing that just wants to use it. This model is an
addref/release nightmare esp if GetInstance() is addreffing.
Neeti and I talked and here is what Neeti is going to try:
- Eliminate GetInstance()
- Access and fill mInstance in Create()
- Get nsFileIO::Open() to check mInstance and call Create() if it aint created
already to get to the nsFileTransportService
Comment 6•23 years ago
|
||
wait a second!!
nsFileTransportService should set mInstance in its constructor, and clear it in
its destructor.
then nsFileTransportService::GetInstance() can be inlined.
then nsFileTransport should AddRef the FTS instance in its constructor and
Release the FTS instance in its destructor.
doing so ensures that the nsFileTransportService is alive for the entire
lifetime of a nsFileTransport.
the current implementation of GetInstance() is missing the fact that you can't
have a nsFileTransport without the nsFileTransportService already existing. it
is the FTS that creates nsFileTransport objects. so, there is no need to have
the check for if (!mInstance)
Comment 8•23 years ago
|
||
One of the things the earlier patch was doing was enforce singleton-ness of
nsFileTransportService, meaning, even if multiple calls to
CreateInstance(..filetransportservice..) happens, only one FTS will exist. That
isn't true anymore (and this is similar to the way code is now). Is that an issue ?
Comment 9•23 years ago
|
||
not an issue since everyone is expected to call do_GetService instead of
do_CreateInstance. perhaps we should enforce it, but we don't here as well as
in many other places :(
i wouldn't object to adding code to enforce singleton-ness :)
Comment 10•23 years ago
|
||
Comment on attachment 61332 [details] [diff] [review]
revised patch with Darin's suggestions
>Index: src/nsFileStreams.cpp
> }
>-
>- if (NS_FAILED(rv)) {
>+
>+ if (!mimeServ || (NS_FAILED(rv))) {
> // if all else fails treat it as text/html?
indentation problems.
>Index: src/nsFileTransportService.h
>+ nsCOMPtr<nsIMIMEService> mMimeService;
>+ static nsFileTransportService* mInstance;
alignment!
otherwise, sr=darin
Attachment #61332 -
Flags: needs-work+
Comment 11•23 years ago
|
||
Comment on attachment 61332 [details] [diff] [review]
revised patch with Darin's suggestions
r=dp if we are absolutely sure that nsFileTransportService::mInstance is not
null when hitting nsFileIO::Open().
Attachment #61332 -
Flags: needs-work+ → review+
| Assignee | ||
Comment 12•23 years ago
|
||
Comment 13•23 years ago
|
||
No need to reattach patch for alignment stuff. Check it in. You have r=dp and
sr=darin
Comment 14•23 years ago
|
||
Comment on attachment 61370 [details] [diff] [review]
fixed alignment and indentation
sr=darin
Attachment #61370 -
Flags: superreview+
| Assignee | ||
Comment 15•23 years ago
|
||
fixed checked in. thanks everyone for the reviews.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Summary: nsFileTransportService should cache the mime service.
Comment 16•23 years ago
|
||
Could someone please write a summary line for this bug?
Updated•23 years ago
|
Summary: nsFileTransportService should cache the mime service.
You need to log in
before you can comment on or make changes to this bug.
Description
•