Work on 49212 and 17470. Add start/stop notifications for perf improvement for

Mark All Read and Delete large number of messages. r=bienvenu.
This commit is contained in:
putterman%netscape.com 2000-09-01 03:26:52 +00:00
Родитель 0332b39574
Коммит 8463f73305
3 изменённых файлов: 32 добавлений и 1 удалений

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

@ -330,4 +330,13 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo);
nsIMsgFolder getChildWithURI(in string uri, in boolean deep);
/**
* Turn notifications on/off for various notification types. Currently only supporting
* allMessageCountNotifications which refers to both total and unread message counts.
*/
const unsigned long allMessageCountNotifications = 0;
void enableNotifications(in long notificationType, in boolean enable);
};

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

@ -94,7 +94,8 @@ nsMsgFolder::nsMsgFolder(void)
mIsServerIsValid(PR_FALSE),
mIsServer(PR_FALSE),
mDeleteIsMoveToTrash(PR_TRUE),
mBaseMessageURI(nsnull)
mBaseMessageURI(nsnull),
mNotifyCountChanges(PR_TRUE)
{
// NS_INIT_REFCNT(); done by superclass
@ -2213,6 +2214,10 @@ nsMsgFolder::NotifyUnicharPropertyChanged(nsIAtom *property,
nsresult nsMsgFolder::NotifyIntPropertyChanged(nsIAtom *property, PRInt32 oldValue, PRInt32 newValue)
{
//Don't send off count notifications if they are turned off.
if(!mNotifyCountChanges && ((property == kTotalMessagesAtom) ||( property == kTotalUnreadMessagesAtom)))
return NS_OK;
nsCOMPtr<nsISupports> supports;
if(NS_SUCCEEDED(QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(supports))))
{
@ -2400,3 +2405,18 @@ nsMsgFolder::GetFilterList(nsIMsgFilterList **aResult)
return server->GetFilterList(aResult);
}
/* void enableNotifications (in long notificationType, in boolean enable); */
NS_IMETHODIMP nsMsgFolder::EnableNotifications(PRInt32 notificationType, PRBool enable)
{
if(notificationType == nsIMsgFolder::allMessageCountNotifications)
{
mNotifyCountChanges = enable;
if(enable)
UpdateSummaryTotals(PR_TRUE);
return NS_OK;
}
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -167,6 +167,7 @@ public:
NS_IMETHOD MarkThreadRead(nsIMsgThread *thread);
NS_IMETHOD GetChildWithURI(const char *uri, PRBool deep, nsIMsgFolder **_retval);
NS_IMETHOD EnableNotifications(PRInt32 notificationType, PRBool enable);
// end NS_DECL_NSIMSGFOLDER
@ -237,6 +238,7 @@ protected:
unknown; -2 means unknown but we already
tried to find out.) */
PRInt32 mNumTotalMessages; /* count of existing messages. */
PRBool mNotifyCountChanges;
PRUint32 mExpungedBytes;
nsCOMPtr<nsISupportsArray> mSubFolders;
nsVoidArray *mListeners; //This can't be an nsISupportsArray because due to