зеркало из https://github.com/mozilla/gecko-dev.git
Cleaned up closing procedure.
This commit is contained in:
Родитель
1aaebda95e
Коммит
5370d83dc2
|
@ -340,8 +340,7 @@ nsFileTransport::Init(nsIFileSystem* fsObj, const char* command,
|
|||
nsFileTransport::~nsFileTransport()
|
||||
{
|
||||
if (mState != CLOSED) {
|
||||
mState = CLOSING;
|
||||
Process();
|
||||
DoClose();
|
||||
}
|
||||
NS_ASSERTION(mSource == nsnull, "transport not closed");
|
||||
NS_ASSERTION(mBufferInputStream == nsnull, "transport not closed");
|
||||
|
@ -991,22 +990,7 @@ nsFileTransport::Process(void)
|
|||
}
|
||||
|
||||
case CLOSING: {
|
||||
PR_LOG(gFileTransportLog, PR_LOG_DEBUG,
|
||||
("nsFileTransport: CLOSING [this=%x %s] status=%x",
|
||||
this, (const char*)mSpec, mStatus));
|
||||
|
||||
if (mOpenObserver) {
|
||||
(void)mOpenObserver->OnStopRequest(this, mOpenContext,
|
||||
mStatus, nsnull); // XXX fix error message
|
||||
mOpenObserver = null_nsCOMPtr();
|
||||
mOpenContext = null_nsCOMPtr();
|
||||
}
|
||||
if (mFileObject) {
|
||||
nsresult rv = mFileObject->Close(mStatus);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected Close failure");
|
||||
mFileObject = null_nsCOMPtr();
|
||||
}
|
||||
mState = CLOSED;
|
||||
DoClose();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1017,6 +1001,27 @@ nsFileTransport::Process(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsFileTransport::DoClose(void)
|
||||
{
|
||||
PR_LOG(gFileTransportLog, PR_LOG_DEBUG,
|
||||
("nsFileTransport: CLOSING [this=%x %s] status=%x",
|
||||
this, (const char*)mSpec, mStatus));
|
||||
|
||||
if (mOpenObserver) {
|
||||
(void)mOpenObserver->OnStopRequest(this, mOpenContext,
|
||||
mStatus, nsnull); // XXX fix error message
|
||||
mOpenObserver = null_nsCOMPtr();
|
||||
mOpenContext = null_nsCOMPtr();
|
||||
}
|
||||
if (mFileObject) {
|
||||
nsresult rv = mFileObject->Close(mStatus);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected Close failure");
|
||||
mFileObject = null_nsCOMPtr();
|
||||
}
|
||||
mState = CLOSED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIPipeObserver methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
PRUint32 bufferMaxSize);
|
||||
|
||||
void Process(void);
|
||||
void DoClose(void);
|
||||
|
||||
enum State {
|
||||
CLOSED,
|
||||
|
|
Загрузка…
Ссылка в новой задаче