Bug 1371438, investigate why assertion fails on Windows, r=bkelly
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sat, 10 Jun 2017 03:21:29 +0300
changeset 411494 6fdd4f87cc0ea91ee036b38fa1ce58f7eaea88ea
parent 411493 aee83eca587fdd51b9b29830eee0905606b25fa9
child 411495 07fcbdb153e29d0fec4420aac2593150365bf7c3
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1371438
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 1371438, investigate why assertion fails on Windows, r=bkelly
xpcom/threads/TimerThread.cpp
--- a/xpcom/threads/TimerThread.cpp
+++ b/xpcom/threads/TimerThread.cpp
@@ -594,17 +594,19 @@ TimeStamp
 TimerThread::FindNextFireTimeForCurrentThread(TimeStamp aDefault, uint32_t aSearchBound)
 {
   MonitorAutoLock lock(mMonitor);
   TimeStamp timeStamp = aDefault;
   uint32_t index = 0;
 
 #ifdef DEBUG
   TimeStamp firstTimeStamp;
+  Entry* initialFirstEntry = nullptr;
   if (!mTimers.IsEmpty()) {
+    initialFirstEntry = mTimers[0].get();
     firstTimeStamp = mTimers[0]->Timeout();
   }
 #endif
 
   auto end = mTimers.end();
   while(end != mTimers.begin()) {
     nsTimerImpl* timer = mTimers[0]->Value();
     if (timer) {
@@ -638,17 +640,29 @@ TimerThread::FindNextFireTimeForCurrentT
     --end;
   }
 
   while (end != mTimers.end()) {
     ++end;
     std::push_heap(mTimers.begin(), end, Entry::UniquePtrLessThan);
   }
 
+#ifdef DEBUG
+  if (!mTimers.IsEmpty()) {
+    if (firstTimeStamp != mTimers[0]->Timeout()) {
+      TimeStamp now = TimeStamp::Now();
+      printf_stderr("firstTimeStamp %f, mTimers[0]->Timeout() %f, "
+                    "initialFirstTimer %p, current first %p\n",
+                    (firstTimeStamp - now).ToMilliseconds(),
+                    (mTimers[0]->Timeout() - now).ToMilliseconds(),
+                    initialFirstEntry, mTimers[0].get());
+    }
+  }
   MOZ_ASSERT_IF(!mTimers.IsEmpty(), firstTimeStamp == mTimers[0]->Timeout());
+#endif
 
   return timeStamp;
 }
 
 // This function must be called from within a lock
 bool
 TimerThread::AddTimerInternal(nsTimerImpl* aTimer)
 {