diff --git a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp index 7afbb0d42d4..37f16bbf8c1 100644 --- a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp +++ b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp @@ -95,13 +95,13 @@ static const char kObserverServiceContractID[] = "@mozilla.org/observer-service; /** * Buffer sizes for serialization and deserialization of scripts. - * These should be tuned at some point. + * FIXME: bug #411579 (tune this macro!) Last updated: Jan 2008 */ #define XPC_SERIALIZATION_BUFFER_SIZE (64 * 1024) -#define XPC_DESERIALIZATION_BUFFER_SIZE (8 * 1024) +#define XPC_DESERIALIZATION_BUFFER_SIZE (12 * 8192) // Inactivity delay before closing our fastload file stream. -static const int kFastLoadWriteDelay = 5000; // 5 seconds +static const int kFastLoadWriteDelay = 10000; // 10 seconds #ifdef PR_LOGGING // NSPR_LOG_MODULES=JSComponentLoader:5 diff --git a/mozilla/modules/libpref/src/nsPrefService.cpp b/mozilla/modules/libpref/src/nsPrefService.cpp index fee1de3c45c..32ddf1a14d1 100644 --- a/mozilla/modules/libpref/src/nsPrefService.cpp +++ b/mozilla/modules/libpref/src/nsPrefService.cpp @@ -68,7 +68,6 @@ // Definitions #define INITIAL_PREF_FILES 10 -#define PREF_READ_BUFFER_SIZE 4096 // Prototypes #ifdef MOZ_PROFILESHARING @@ -586,7 +585,6 @@ static PRBool isSharingEnabled() static nsresult openPrefFile(nsIFile* aFile) { nsCOMPtr inStr; - char readBuf[PREF_READ_BUFFER_SIZE]; #if MOZ_TIMELINE { @@ -600,21 +598,33 @@ static nsresult openPrefFile(nsIFile* aFile) if (NS_FAILED(rv)) return rv; + PRInt64 fileSize; + rv = aFile->GetFileSize(&fileSize); + if (NS_FAILED(rv)) + return rv; + + char *fileBuffer = nsnull; + fileBuffer = new char[nsInt64(fileSize)]; + if (fileBuffer == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint32 amtRead = 0; + rv = inStr->Read(fileBuffer, fileSize, &amtRead); + if (NS_FAILED(rv)) { + delete fileBuffer; + return rv; + } + PrefParseState ps; PREF_InitParseState(&ps, PREF_ReaderCallback, NULL); - nsresult rv2 = NS_OK; - for (;;) { - PRUint32 amtRead = 0; - rv = inStr->Read(readBuf, sizeof(readBuf), &amtRead); - if (NS_FAILED(rv) || amtRead == 0) - break; - if (!PREF_ParseBuf(&ps, readBuf, amtRead)) { - rv2 = NS_ERROR_FILE_CORRUPTED; - } - } + if (!PREF_ParseBuf(&ps, fileBuffer, amtRead)) + rv = NS_ERROR_FILE_CORRUPTED; + PREF_FinalizeParseState(&ps); - return NS_FAILED(rv) ? rv : rv2; + delete fileBuffer; + + return rv; } /* diff --git a/mozilla/xpcom/io/nsFastLoadFile.cpp b/mozilla/xpcom/io/nsFastLoadFile.cpp index b50881cffc7..1b56eba2835 100644 --- a/mozilla/xpcom/io/nsFastLoadFile.cpp +++ b/mozilla/xpcom/io/nsFastLoadFile.cpp @@ -630,9 +630,9 @@ nsFastLoadFileReader::SetInputStream(nsIInputStream *aInputStream) } /** - * XXX tuneme + * FIXME: bug #411579 (tune this macro!) Last updated: Jan 2008 */ -#define MFL_CHECKSUM_BUFSIZE 8192 +#define MFL_CHECKSUM_BUFSIZE (6 * 8192) NS_IMETHODIMP nsFastLoadFileReader::ComputeChecksum(PRUint32 *aResult)