fix bug 650750, perf slowdown with NFS local mailboxes, r=bienvenu
This commit is contained in:
Родитель
c63eb43239
Коммит
7f7ab716e4
|
@ -30,6 +30,7 @@ ErrorAccordingToNSPR()
|
|||
nsMsgFileStream::nsMsgFileStream()
|
||||
{
|
||||
mFileDesc = nsnull;
|
||||
mSeekedToEnd = PR_FALSE;
|
||||
}
|
||||
|
||||
nsMsgFileStream::~nsMsgFileStream()
|
||||
|
@ -50,11 +51,17 @@ nsMsgFileStream::Seek(PRInt32 whence, PRInt64 offset)
|
|||
{
|
||||
if (mFileDesc == nsnull)
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
|
||||
|
||||
PRBool seekingToEnd = whence == PR_SEEK_END && offset == 0;
|
||||
if (seekingToEnd && mSeekedToEnd)
|
||||
return NS_OK;
|
||||
|
||||
PRInt64 cnt = PR_Seek64(mFileDesc, offset, (PRSeekWhence)whence);
|
||||
if (cnt == PRInt64(-1)) {
|
||||
return ErrorAccordingToNSPR();
|
||||
}
|
||||
|
||||
mSeekedToEnd = seekingToEnd;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,15 @@ public:
|
|||
~nsMsgFileStream();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
|
||||
NS_IMETHOD Available(PRUint32 *_retval);
|
||||
NS_IMETHOD Read(char * aBuf, PRUint32 aCount, PRUint32 *_retval);
|
||||
NS_IMETHOD ReadSegments(nsWriteSegmentFun aWriter, void * aClosure, PRUint32 aCount, PRUint32 *_retval);
|
||||
NS_DECL_NSIOUTPUTSTREAM
|
||||
NS_DECL_NSISEEKABLESTREAM
|
||||
|
||||
|
||||
nsresult InitWithFile(nsILocalFile *localFile);
|
||||
protected:
|
||||
PRFileDesc *mFileDesc;
|
||||
PRBool mSeekedToEnd;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче