Bug 530382. Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in docshell. r=jst
authorJae-Seong Lee-Russo <lusian@gmail.com>
Tue, 09 Feb 2010 12:09:06 -0500
changeset 38012 66d7289522a674c0ae75b6648ebac4547c2fcd12
parent 38011 df90f0171ba7d51f932769131d4d0992b6debaa9
child 38013 bb7f5fa01db7f571ae3adb61b34aa2c63392bddd
push id11564
push userbzbarsky@mozilla.com
push dateTue, 09 Feb 2010 17:10:53 +0000
treeherdermozilla-central@bb7f5fa01db7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs530382
milestone1.9.3a2pre
Bug 530382. Replace PR_MIN/PR_MAX with NS_MIN/NS_MAX in docshell. r=jst
docshell/base/nsDocShell.cpp
docshell/shistory/src/nsSHistory.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -2107,18 +2107,18 @@ nsDocShell::GetLoadedTransIndex(PRInt32 
 NS_IMETHODIMP
 nsDocShell::HistoryPurged(PRInt32 aNumEntries)
 {
     // These indices are used for fastback cache eviction, to determine
     // which session history entries are candidates for content viewer
     // eviction.  We need to adjust by the number of entries that we
     // just purged from history, so that we look at the right session history
     // entries during eviction.
-    mPreviousTransIndex = PR_MAX(-1, mPreviousTransIndex - aNumEntries);
-    mLoadedTransIndex = PR_MAX(0, mLoadedTransIndex - aNumEntries);
+    mPreviousTransIndex = NS_MAX(-1, mPreviousTransIndex - aNumEntries);
+    mLoadedTransIndex = NS_MAX(0, mLoadedTransIndex - aNumEntries);
 
     PRInt32 count = mChildList.Count();
     for (PRInt32 i = 0; i < count; ++i) {
         nsCOMPtr<nsIDocShell> shell = do_QueryInterface(ChildAt(i));
         if (shell) {
             shell->HistoryPurged(aNumEntries);
         }
     }
--- a/docshell/shistory/src/nsSHistory.cpp
+++ b/docshell/shistory/src/nsSHistory.cpp
@@ -546,17 +546,17 @@ nsSHistory::SetMaxLength(PRInt32 aMaxSiz
 }
 
 NS_IMETHODIMP
 nsSHistory::PurgeHistory(PRInt32 aEntries)
 {
   if (mLength <= 0 || aEntries <= 0)
     return NS_ERROR_FAILURE;
 
-  aEntries = PR_MIN(aEntries, mLength);
+  aEntries = NS_MIN(aEntries, mLength);
   
   PRBool purgeHistory = PR_TRUE;
   // Notify the listener about the history purge
   if (mListener) {
     nsCOMPtr<nsISHistoryListener> listener(do_QueryReferent(mListener));
     if (listener) {
       listener->OnHistoryPurge(aEntries, &purgeHistory);
     } 
@@ -808,23 +808,23 @@ nsSHistory::EvictWindowContentViewers(PR
   // These indices give the range of SHEntries whose content viewers will be
   // evicted
   PRInt32 startIndex, endIndex;
   if (aToIndex > aFromIndex) { // going forward
     endIndex = aToIndex - gHistoryMaxViewers;
     if (endIndex <= 0) {
       return;
     }
-    startIndex = PR_MAX(0, aFromIndex - gHistoryMaxViewers);
+    startIndex = NS_MAX(0, aFromIndex - gHistoryMaxViewers);
   } else { // going backward
     startIndex = aToIndex + gHistoryMaxViewers + 1;
     if (startIndex >= mLength) {
       return;
     }
-    endIndex = PR_MIN(mLength, aFromIndex + gHistoryMaxViewers + 1);
+    endIndex = NS_MIN(mLength, aFromIndex + gHistoryMaxViewers + 1);
   }
 
 #ifdef DEBUG
   nsCOMPtr<nsISHTransaction> trans;
   GetTransactionAtIndex(0, getter_AddRefs(trans));
 
   // Walk the full session history and check that entries outside the window
   // around aFromIndex have no content viewers
@@ -908,18 +908,18 @@ nsSHistory::EvictGlobalContentViewer()
     PRInt32 totalContentViewers = 0;
     nsSHistory* shist = static_cast<nsSHistory*>
                                    (PR_LIST_HEAD(&gSHistoryList));
     while (shist != &gSHistoryList) {
       // Calculate the window of SHEntries that could possibly have a content
       // viewer.  There could be up to gHistoryMaxViewers content viewers,
       // but we don't know whether they are before or after the mIndex position
       // in the SHEntry list.  Just check both sides, to be safe.
-      PRInt32 startIndex = PR_MAX(0, shist->mIndex - gHistoryMaxViewers);
-      PRInt32 endIndex = PR_MIN(shist->mLength - 1,
+      PRInt32 startIndex = NS_MAX(0, shist->mIndex - gHistoryMaxViewers);
+      PRInt32 endIndex = NS_MIN(shist->mLength - 1,
                                 shist->mIndex + gHistoryMaxViewers);
       nsCOMPtr<nsISHTransaction> trans;
       shist->GetTransactionAtIndex(startIndex, getter_AddRefs(trans));
       
       for (PRInt32 i = startIndex; i <= endIndex; ++i) {
         nsCOMPtr<nsISHEntry> entry;
         trans->GetSHEntry(getter_AddRefs(entry));
         nsCOMPtr<nsIContentViewer> viewer;
@@ -1001,18 +1001,18 @@ nsSHistory::EvictGlobalContentViewer()
       shouldTryEviction = PR_FALSE;
     }
   }  // while shouldTryEviction
 }
 
 NS_IMETHODIMP
 nsSHistory::EvictExpiredContentViewerForEntry(nsISHEntry *aEntry)
 {
-  PRInt32 startIndex = PR_MAX(0, mIndex - gHistoryMaxViewers);
-  PRInt32 endIndex = PR_MIN(mLength - 1,
+  PRInt32 startIndex = NS_MAX(0, mIndex - gHistoryMaxViewers);
+  PRInt32 endIndex = NS_MIN(mLength - 1,
                             mIndex + gHistoryMaxViewers);
   nsCOMPtr<nsISHTransaction> trans;
   GetTransactionAtIndex(startIndex, getter_AddRefs(trans));
 
   PRInt32 i;
   for (i = startIndex; i <= endIndex; ++i) {
     nsCOMPtr<nsISHEntry> entry;
     trans->GetSHEntry(getter_AddRefs(entry));