Bug 1363036 - Part 1: Remove MOZ_DIAGNOSTIC_ASSERTs previously added for bug hunting. r=smaug
authorSamael Wang <freesamael@gmail.com>
Mon, 22 May 2017 11:25:54 +0800
changeset 360631 68e0dc399cf77480049c3b26f6bb16aef990b59d
parent 360630 b11d1ccfa3db4674c7f180d0f89fa1d42b4935ec
child 360632 98b85a78d45ff9168b080dbbf2bb45f5470b7769
push id31890
push userryanvm@gmail.com
push dateThu, 25 May 2017 20:32:08 +0000
treeherdermozilla-central@bdf2d1918fb0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1363036
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1363036 - Part 1: Remove MOZ_DIAGNOSTIC_ASSERTs previously added for bug hunting. r=smaug MozReview-Commit-ID: BAkuRlHtMcP
docshell/shistory/nsSHEntry.cpp
docshell/shistory/nsSHEntryShared.cpp
docshell/shistory/nsSHistory.cpp
xpcom/ds/nsExpirationTracker.h
--- a/docshell/shistory/nsSHEntry.cpp
+++ b/docshell/shistory/nsSHEntry.cpp
@@ -974,12 +974,12 @@ nsSHEntry::SetLastTouched(uint32_t aLast
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHEntry::SetSHistory(nsISHistory* aSHistory)
 {
   nsWeakPtr shistory = do_GetWeakReference(aSHistory);
   // mSHistory can not be changed once it's set
-  MOZ_DIAGNOSTIC_ASSERT(!mShared->mSHistory || (mShared->mSHistory == shistory));
+  MOZ_ASSERT(!mShared->mSHistory || (mShared->mSHistory == shistory));
   mShared->mSHistory = shistory;
   return NS_OK;
 }
--- a/docshell/shistory/nsSHEntryShared.cpp
+++ b/docshell/shistory/nsSHEntryShared.cpp
@@ -132,17 +132,17 @@ nsSHEntryShared::SetContentViewer(nsICon
 
   if (mContentViewer || !aViewer) {
     DropPresentationState();
   }
 
   // If we're setting mContentViewer to null, state should already be cleared
   // in the DropPresentationState() call above; If we're setting it to a
   // non-null content viewer, the entry shouldn't have been tracked either.
-  MOZ_DIAGNOSTIC_ASSERT(!GetExpirationState()->IsTracked());
+  MOZ_ASSERT(!GetExpirationState()->IsTracked());
   mContentViewer = aViewer;
 
   if (mContentViewer) {
     // mSHistory is only set for root entries, but in general bfcache only
     // applies to root entries as well. BFCache for subframe navigation has been
     // disabled since 2005 in bug 304860.
     nsCOMPtr<nsISHistoryInternal> shistory = do_QueryReferent(mSHistory);
     if (shistory) {
--- a/docshell/shistory/nsSHistory.cpp
+++ b/docshell/shistory/nsSHistory.cpp
@@ -1315,17 +1315,17 @@ nsSHistory::AddToExpirationTracker(nsIBF
   mHistoryTracker->AddObject(entry);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSHistory::RemoveFromExpirationTracker(nsIBFCacheEntry* aEntry)
 {
   RefPtr<nsSHEntryShared> entry = static_cast<nsSHEntryShared*>(aEntry);
-  MOZ_DIAGNOSTIC_ASSERT(mHistoryTracker && !mHistoryTracker->IsEmpty());
+  MOZ_ASSERT(mHistoryTracker && !mHistoryTracker->IsEmpty());
   if (!mHistoryTracker || !entry) {
     return NS_ERROR_FAILURE;
   }
 
   mHistoryTracker->RemoveObject(entry);
   return NS_OK;
 }
 
@@ -1923,29 +1923,26 @@ nsSHistory::InitiateLoad(nsISHEntry* aFr
   return aFrameDS->LoadURI(nextURI, loadInfo,
                            nsIWebNavigation::LOAD_FLAGS_NONE, false);
 
 }
 
 NS_IMETHODIMP
 nsSHistory::SetRootDocShell(nsIDocShell* aDocShell)
 {
-  MOZ_DIAGNOSTIC_ASSERT(!aDocShell || !mRootDocShell);
   mRootDocShell = aDocShell;
 
   // Init mHistoryTracker on setting mRootDocShell so we can bind its event
   // target to the tabGroup.
   if (mRootDocShell) {
     nsCOMPtr<nsPIDOMWindowOuter> win = mRootDocShell->GetWindow();
     if (!win) {
       return NS_ERROR_UNEXPECTED;
     }
 
-    // mHistroyTracker can only be set once.
-    MOZ_DIAGNOSTIC_ASSERT(!mHistoryTracker);
     RefPtr<mozilla::dom::TabGroup> tabGroup = win->TabGroup();
     mHistoryTracker = mozilla::MakeUnique<HistoryTracker>(
       this,
       mozilla::Preferences::GetUint(CONTENT_VIEWER_TIMEOUT_SECONDS,
                                     CONTENT_VIEWER_TIMEOUT_SECONDS_DEFAULT),
       tabGroup->EventTargetFor(mozilla::TaskCategory::Other));
   }
 
--- a/xpcom/ds/nsExpirationTracker.h
+++ b/xpcom/ds/nsExpirationTracker.h
@@ -142,18 +142,18 @@ public:
   /**
    * Add an object to be tracked. It must not already be tracked. It will
    * be added to the newest generation, i.e., as if it was just used.
    * @return an error on out-of-memory
    */
   nsresult AddObjectLocked(T* aObj, const AutoLock& aAutoLock)
   {
     nsExpirationState* state = aObj->GetExpirationState();
-    MOZ_DIAGNOSTIC_ASSERT(!state->IsTracked(),
-                          "Tried to add an object that's already tracked");
+    MOZ_ASSERT(!state->IsTracked(),
+               "Tried to add an object that's already tracked");
     nsTArray<T*>& generation = mGenerations[mNewestGeneration];
     uint32_t index = generation.Length();
     if (index > nsExpirationState::MAX_INDEX_IN_GENERATION) {
       NS_WARNING("More than 256M elements tracked, this is probably a problem");
       return NS_ERROR_OUT_OF_MEMORY;
     }
     if (index == 0) {
       // We might need to start the timer
@@ -171,28 +171,28 @@ public:
   }
 
   /**
    * Remove an object from the tracker. It must currently be tracked.
    */
   void RemoveObjectLocked(T* aObj, const AutoLock& aAutoLock)
   {
     nsExpirationState* state = aObj->GetExpirationState();
-    MOZ_DIAGNOSTIC_ASSERT(state->IsTracked(), "Tried to remove an object that's not tracked");
+    MOZ_ASSERT(state->IsTracked(), "Tried to remove an object that's not tracked");
     nsTArray<T*>& generation = mGenerations[state->mGeneration];
     uint32_t index = state->mIndexInGeneration;
-    MOZ_DIAGNOSTIC_ASSERT(generation.Length() > index &&
-                          generation[index] == aObj, "Object is lying about its index");
+    MOZ_ASSERT(generation.Length() > index &&
+               generation[index] == aObj, "Object is lying about its index");
     // Move the last object to fill the hole created by removing aObj
     uint32_t last = generation.Length() - 1;
     T* lastObj = generation[last];
     generation[index] = lastObj;
     lastObj->GetExpirationState()->mIndexInGeneration = index;
     generation.RemoveElementAt(last);
-    MOZ_DIAGNOSTIC_ASSERT(generation.Length() == last);
+    MOZ_ASSERT(generation.Length() == last);
     state->mGeneration = nsExpirationState::NOT_TRACKED;
     // We do not check whether we need to stop the timer here. The timer
     // will check that itself next time it fires. Checking here would not
     // be efficient since we'd need to track all generations. Also we could
     // thrash by incessantly creating and destroying timers if someone
     // kept adding and removing an object from the tracker.
   }