part one of bug 113163 "Performance problem at downloading"

patch=ak@muc.de, r=gordon@netscape.com, sr=darin@netscape.com
This commit is contained in:
darin%netscape.com 2002-01-29 02:58:02 +00:00
Родитель 3a9427fab8
Коммит 0686983ad3
2 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -86,6 +86,7 @@ nsStorageTransport::nsStorageTransport()
, mSegmentSize(DEFAULT_SEGMENT_SIZE) , mSegmentSize(DEFAULT_SEGMENT_SIZE)
, mMaxSize(DEFAULT_BUFFER_SIZE) , mMaxSize(DEFAULT_BUFFER_SIZE)
, mSegments(nsnull) , mSegments(nsnull)
, mSegmentsLast(nsnull)
, mWriteSegment(nsnull) , mWriteSegment(nsnull)
, mWriteCursor(0) , mWriteCursor(0)
{ {
@ -226,11 +227,9 @@ nsStorageTransport::AppendSegment(nsSegment *aSegment)
{ {
if (!mSegments) if (!mSegments)
mSegments = aSegment; mSegments = aSegment;
else { else
nsSegment *s = mSegments; mSegmentsLast->next = aSegment;
for (; s && s->next; s = s->next); mSegmentsLast = aSegment;
s->next = aSegment;
}
} }
void void
@ -249,7 +248,7 @@ nsStorageTransport::TruncateTo(PRUint32 aOffset)
if (aOffset < mWriteCursor) { if (aOffset < mWriteCursor) {
if (aOffset == 0) { if (aOffset == 0) {
DeleteSegments(mSegments); DeleteSegments(mSegments);
mSegments = nsnull; mSegments = mSegmentsLast = nsnull;
mWriteSegment = nsnull; mWriteSegment = nsnull;
} }
else { else {
@ -265,6 +264,7 @@ nsStorageTransport::TruncateTo(PRUint32 aOffset)
DeleteSegments(s->next); DeleteSegments(s->next);
s->next = nsnull; s->next = nsnull;
} }
mSegmentsLast = s;
mWriteSegment = s; mWriteSegment = s;
} }
} }

Просмотреть файл

@ -197,6 +197,7 @@ private:
PRUint32 mMaxSize; PRUint32 mMaxSize;
nsSegment *mSegments; nsSegment *mSegments;
nsSegment *mSegmentsLast;
nsSegment *mWriteSegment; nsSegment *mWriteSegment;
PRUint32 mWriteCursor; PRUint32 mWriteCursor;