Bug 1267819: Add a diagnostic assertion. r=froydnj
authorKyle Huey <khuey@kylehuey.com>
Tue, 28 Jun 2016 10:47:23 -0700
changeset 302988 8186a2778f9d184852ee0a7fa369b602fab03111
parent 302987 58954ad707106456fa5f6c2b5787430398a4dd64
child 302989 08f48f6431b98185d5027667c6bbb57896a48e50
push id30379
push usercbook@mozilla.com
push dateWed, 29 Jun 2016 14:13:35 +0000
treeherdermozilla-central@b69a5bbb5e40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1267819
milestone50.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 1267819: Add a diagnostic assertion. r=froydnj
xpcom/threads/nsEventQueue.cpp
--- a/xpcom/threads/nsEventQueue.cpp
+++ b/xpcom/threads/nsEventQueue.cpp
@@ -52,18 +52,23 @@ nsEventQueue::GetEvent(bool aMayWait, ns
       return false;
     }
     LOG(("EVENTQ(%p): wait begin\n", this));
     mEventsAvailable.Wait();
     LOG(("EVENTQ(%p): wait end\n", this));
   }
 
   if (aResult) {
+    MOZ_ASSERT(mOffsetHead < EVENTS_PER_PAGE);
+    MOZ_ASSERT_IF(mHead == mTail, mOffsetHead <= mOffsetTail);
     *aResult = mHead->mEvents[mOffsetHead++];
 
+    MOZ_ASSERT(*aResult);
+    MOZ_ASSERT(mOffsetHead <= EVENTS_PER_PAGE);
+
     // Check if mHead points to empty Page
     if (mOffsetHead == EVENTS_PER_PAGE) {
       Page* dead = mHead;
       mHead = mHead->mNext;
       FreePage(dead);
       mOffsetHead = 0;
     }
   }