113397 r=bienvenu sr=mscott. reduce the cache size once the folder has been loaded.

This commit is contained in:
naving%netscape.com 2001-12-12 01:47:24 +00:00
Родитель 2c4c74211a
Коммит 43c32c2824
3 изменённых файлов: 18 добавлений и 14 удалений

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

@ -56,6 +56,7 @@ var gHaveLoadedMessage;
var gDisplayStartupPage = false; var gDisplayStartupPage = false;
// the folderListener object // the folderListener object
var folderListener = { var folderListener = {
OnItemAdded: function(parentItem, item, view) { }, OnItemAdded: function(parentItem, item, view) { },
@ -103,7 +104,6 @@ var folderListener = {
var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder); var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
if(msgFolder) { if(msgFolder) {
msgFolder.endFolderLoading(); msgFolder.endFolderLoading();
// suppress command updating when rerooting the folder // suppress command updating when rerooting the folder
// when rerooting, we'll be clearing the selection // when rerooting, we'll be clearing the selection
// which will cause us to update commands. // which will cause us to update commands.
@ -112,6 +112,10 @@ var folderListener = {
} }
if (gRerootOnFolderLoad) if (gRerootOnFolderLoad)
RerootFolder(uri, msgFolder, gCurrentLoadingFolderViewType, gCurrentLoadingFolderViewFlags, gCurrentLoadingFolderSortType, gCurrentLoadingFolderSortOrder); RerootFolder(uri, msgFolder, gCurrentLoadingFolderViewType, gCurrentLoadingFolderViewFlags, gCurrentLoadingFolderSortType, gCurrentLoadingFolderSortOrder);
var db = msgFolder.getMsgDatabase(msgWindow);
if (db)
db.resetHdrCacheSize(100);
if (gDBView) { if (gDBView) {
gDBView.suppressCommandUpdating = false; gDBView.suppressCommandUpdating = false;
@ -560,18 +564,7 @@ function loadStartFolder(initialUri)
{ {
// Perform biff on the server to check for new mail, except for imap // Perform biff on the server to check for new mail, except for imap
if (defaultServer.type != "imap") if (defaultServer.type != "imap")
{ defaultServer.PerformBiff();
var localFolder = inboxFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
if (localFolder)
{
if (!localFolder.parsingInbox)
defaultServer.PerformBiff();
else
localFolder.checkForNewMessagesAfterParsing = true;
}
else //it can be only nntp
defaultServer.PerformBiff();
}
} }
// because the "open" state persists, we'll call // because the "open" state persists, we'll call

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

@ -117,6 +117,7 @@ interface nsIMsgDatabase : nsIDBChangeAnnouncer {
// In 4.x, it was mainly used to remove corrupted databases. // In 4.x, it was mainly used to remove corrupted databases.
void ForceClosed(); void ForceClosed();
void clearCachedHdrs(); void clearCachedHdrs();
void resetHdrCacheSize(in unsigned long size);
readonly attribute nsIDBFolderInfo dBFolderInfo; readonly attribute nsIDBFolderInfo dBFolderInfo;

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

@ -95,7 +95,7 @@ static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
#define MSG_HASH_SIZE 512 #define MSG_HASH_SIZE 512
const PRInt32 kMaxHdrsInCache = 512; // this will be used on discovery, since we don't know total, and after loading (and sorting), on a new header, we'll use this. const PRInt32 kMaxHdrsInCache = 512; // this will be used on discovery, since we don't know total
// special keys // special keys
static const nsMsgKey kAllMsgHdrsTableKey = 1; static const nsMsgKey kAllMsgHdrsTableKey = 1;
@ -4260,3 +4260,13 @@ NS_IMETHODIMP nsMsgDatabase::GetDefaultSortType(nsMsgViewSortTypeValue *aDefault
*aDefaultSortType = nsMsgViewSortType::byDate; *aDefaultSortType = nsMsgViewSortType::byDate;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsMsgDatabase::ResetHdrCacheSize(PRUint32 aSize)
{
if (m_cacheSize > aSize)
{
m_cacheSize = aSize;
ClearHdrCache(PR_FALSE);
}
return NS_OK;
}