fixes bug 243250 "reduce size of nsStandardURL" r=biesi sr=bzbarsky

This commit is contained in:
darin%meer.net 2004-05-11 18:58:58 +00:00
parent 9e90372ecc
commit d4c73f8d53
2 changed files with 10 additions and 9 deletions

View File

@ -277,10 +277,10 @@ nsSegmentEncoder::InitUnicodeEncoder()
nsStandardURL::nsStandardURL(PRBool aSupportsFileURL) nsStandardURL::nsStandardURL(PRBool aSupportsFileURL)
: mDefaultPort(-1) : mDefaultPort(-1)
, mPort(-1) , mPort(-1)
, mURLType(URLTYPE_STANDARD)
, mHostA(nsnull) , mHostA(nsnull)
, mHostEncoding(eEncoding_ASCII) , mHostEncoding(eEncoding_ASCII)
, mSpecEncoding(eEncoding_Unknown) , mSpecEncoding(eEncoding_Unknown)
, mURLType(URLTYPE_STANDARD)
, mMutable(PR_TRUE) , mMutable(PR_TRUE)
, mSupportsFileURL(aSupportsFileURL) , mSupportsFileURL(aSupportsFileURL)
{ {
@ -1472,7 +1472,6 @@ nsStandardURL::Clone(nsIURI **result)
if (!clone) if (!clone)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
// XXX a copy-on-write string would be very nice here
clone->mSpec = mSpec; clone->mSpec = mSpec;
clone->mDefaultPort = mDefaultPort; clone->mDefaultPort = mDefaultPort;
clone->mPort = mPort; clone->mPort = mPort;
@ -2370,8 +2369,10 @@ nsStandardURL::Read(nsIObjectInputStream *stream)
{ {
nsresult rv; nsresult rv;
rv = stream->Read32(&mURLType); PRUint32 urlType;
rv = stream->Read32(&urlType);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
mURLType = urlType;
switch (mURLType) { switch (mURLType) {
case URLTYPE_STANDARD: case URLTYPE_STANDARD:
mParser = net_GetStdURLParser(); mParser = net_GetStdURLParser();

View File

@ -229,21 +229,21 @@ private:
URLSegment mRef; URLSegment mRef;
nsCString mOriginCharset; nsCString mOriginCharset;
PRUint32 mURLType;
nsCOMPtr<nsIURLParser> mParser; nsCOMPtr<nsIURLParser> mParser;
nsCOMPtr<nsIFile> mFile; // cached result for nsIFileURL::GetFile nsCOMPtr<nsIFile> mFile; // cached result for nsIFileURL::GetFile
char *mHostA; // cached result for nsIURI::GetHostA char *mHostA; // cached result for nsIURI::GetHostA
enum nsEncodingType { enum {
eEncoding_Unknown, eEncoding_Unknown,
eEncoding_ASCII, eEncoding_ASCII,
eEncoding_UTF8 eEncoding_UTF8
}; };
nsEncodingType mHostEncoding;
nsEncodingType mSpecEncoding;
PRPackedBool mMutable; // nsIStandardURL::mutable PRUint32 mHostEncoding : 2; // eEncoding_xxx
PRPackedBool mSupportsFileURL; // QI to nsIFileURL? PRUint32 mSpecEncoding : 2; // eEncoding_xxx
PRUint32 mURLType : 2; // nsIStandardURL::URLTYPE_xxx
PRUint32 mMutable : 1; // nsIStandardURL::mutable
PRUint32 mSupportsFileURL : 1; // QI to nsIFileURL?
// global objects. don't use COMPtr as its destructor will cause a // global objects. don't use COMPtr as its destructor will cause a
// coredump if we leak it. // coredump if we leak it.