Merge mozilla-central to autoland
authorDorel Luca <dluca@mozilla.com>
Thu, 26 Apr 2018 00:34:31 +0300
changeset 469114 594b7c98700a7c29bd003c37cb839f4f6a231dbe
parent 469113 8645b620dad4d104616775593b1a368d16c76721 (current diff)
parent 469047 e33e5049d9f35e16893f5ba4ec823f69f04972dd (diff)
child 469115 674b3e7dd3dd29c45444df15fba1953346bb27cb
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone61.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
Merge mozilla-central to autoland
--- a/dom/chrome-webidl/ChromeUtils.webidl
+++ b/dom/chrome-webidl/ChromeUtils.webidl
@@ -306,22 +306,20 @@ partial namespace ChromeUtils {
    * Creates a JS Error object with the given message and stack.
    *
    * If a stack object is provided, the error object is created in the global
    * that it belongs to.
    */
   [Throws]
   object createError(DOMString message, optional object? stack = null);
 
-#ifndef RELEASE_OR_BETA
   /**
    * Request performance metrics to the current process & all ontent processes.
    */
   void requestPerformanceMetrics();
-#endif
 };
 
 /**
  * Used by principals and the script security manager to represent origin
  * attributes. The first dictionary is designed to contain the full set of
  * OriginAttributes, the second is used for pattern-matching (i.e. does this
  * OriginAttributesDictionary match the non-empty attributes in this pattern).
  *
--- a/mozglue/misc/ConditionVariable_windows.cpp
+++ b/mozglue/misc/ConditionVariable_windows.cpp
@@ -49,31 +49,31 @@ void
 mozilla::detail::ConditionVariableImpl::notify_all()
 {
   WakeAllConditionVariable(&platformData()->cv_);
 }
 
 void
 mozilla::detail::ConditionVariableImpl::wait(MutexImpl& lock)
 {
-  SRWLOCK* srwlock = &lock.platformData()->lock;
-  bool r = SleepConditionVariableSRW(&platformData()->cv_, srwlock, INFINITE, 0);
+  CRITICAL_SECTION* cs = &lock.platformData()->criticalSection;
+  bool r = SleepConditionVariableCS(&platformData()->cv_, cs, INFINITE);
   MOZ_RELEASE_ASSERT(r);
 }
 
 mozilla::CVStatus
 mozilla::detail::ConditionVariableImpl::wait_for(MutexImpl& lock,
                                                  const mozilla::TimeDuration& rel_time)
 {
   if (rel_time == mozilla::TimeDuration::Forever()) {
     wait(lock);
     return CVStatus::NoTimeout;
   }
 
-  SRWLOCK* srwlock = &lock.platformData()->lock;
+  CRITICAL_SECTION* cs = &lock.platformData()->criticalSection;
 
   // Note that DWORD is unsigned, so we have to be careful to clamp at 0. If
   // rel_time is Forever, then ToMilliseconds is +inf, which evaluates as
   // greater than UINT32_MAX, resulting in the correct INFINITE wait. We also
   // don't want to round sub-millisecond waits to 0, as that wastes energy (see
   // bug 1437167 comment 6), so we instead round submillisecond waits to 1ms.
   double msecd = rel_time.ToMilliseconds();
   DWORD msec;
@@ -84,17 +84,17 @@ mozilla::detail::ConditionVariableImpl::
   } else {
     msec = static_cast<DWORD>(msecd);
     // Round submillisecond waits to 1ms.
     if (msec == 0 && !rel_time.IsZero()) {
       msec = 1;
     }
   }
 
-  BOOL r = SleepConditionVariableSRW(&platformData()->cv_, srwlock, msec, 0);
+  BOOL r = SleepConditionVariableCS(&platformData()->cv_, cs, msec);
   if (r)
     return CVStatus::NoTimeout;
   MOZ_RELEASE_ASSERT(GetLastError() == ERROR_TIMEOUT);
   return CVStatus::Timeout;
 }
 
 mozilla::detail::ConditionVariableImpl::~ConditionVariableImpl()
 {
--- a/mozglue/misc/MutexPlatformData_windows.h
+++ b/mozglue/misc/MutexPlatformData_windows.h
@@ -8,12 +8,12 @@
 #define MutexPlatformData_windows_h
 
 #include <windows.h>
 
 #include "mozilla/PlatformMutex.h"
 
 struct mozilla::detail::MutexImpl::PlatformData
 {
-  SRWLOCK lock;
+  CRITICAL_SECTION criticalSection;
 };
 
 #endif // MutexPlatformData_windows_h
--- a/mozglue/misc/Mutex_windows.cpp
+++ b/mozglue/misc/Mutex_windows.cpp
@@ -9,33 +9,48 @@
 #include "mozilla/PlatformMutex.h"
 
 #include <windows.h>
 
 #include "MutexPlatformData_windows.h"
 
 mozilla::detail::MutexImpl::MutexImpl()
 {
-  InitializeSRWLock(&platformData()->lock);
+  // This number was adopted from NSPR.
+  const static DWORD LockSpinCount = 1500;
+
+#if defined(RELEASE_OR_BETA)
+  // Vista and later automatically allocate and subsequently leak a debug info
+  // object for each critical section that we allocate unless we tell the
+  // system not to do that.
+  DWORD flags = CRITICAL_SECTION_NO_DEBUG_INFO;
+#else
+  DWORD flags = 0;
+#endif // defined(RELEASE_OR_BETA)
+
+  BOOL r = InitializeCriticalSectionEx(&platformData()->criticalSection,
+                                       LockSpinCount, flags);
+  MOZ_RELEASE_ASSERT(r);
 }
 
 mozilla::detail::MutexImpl::~MutexImpl()
 {
+  DeleteCriticalSection(&platformData()->criticalSection);
 }
 
 void
 mozilla::detail::MutexImpl::lock()
 {
-  AcquireSRWLockExclusive(&platformData()->lock);
+  EnterCriticalSection(&platformData()->criticalSection);
 }
 
 void
 mozilla::detail::MutexImpl::unlock()
 {
-  ReleaseSRWLockExclusive(&platformData()->lock);
+  LeaveCriticalSection(&platformData()->criticalSection);
 }
 
 mozilla::detail::MutexImpl::PlatformData*
 mozilla::detail::MutexImpl::platformData()
 {
   static_assert(sizeof(platformData_) >= sizeof(PlatformData),
                 "platformData_ is too small");
   return reinterpret_cast<PlatformData*>(platformData_);