Bug 923486, part 2 - Define NS_IsMainThread out-of-line in ASAN builds. r=ehsan
authorAndrew McCreight <amccreight@mozilla.com>
Thu, 03 Oct 2013 11:58:41 -0700
changeset 165258 d57a11856d8bffd5a2724ba9a13d3c1a6fea8339
parent 165257 8c34a47385fdfa606bef4b0f250e429505de3faa
child 165259 cc9ce7c8ab997aedfca52933f7637aa63c356de8
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs923486
milestone27.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 923486, part 2 - Define NS_IsMainThread out-of-line in ASAN builds. r=ehsan
xpcom/glue/MainThreadUtils.h
xpcom/glue/nsThreadUtils.cpp
--- a/xpcom/glue/MainThreadUtils.h
+++ b/xpcom/glue/MainThreadUtils.h
@@ -24,24 +24,24 @@ NS_GetMainThread(nsIThread **result);
 #if defined(MOZILLA_INTERNAL_API) && defined(XP_WIN)
 bool NS_IsMainThread();
 #elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS)
 // This is defined in nsThreadManager.cpp and initialized to `Main` for the
 // main thread by nsThreadManager::Init.
 extern NS_TLS mozilla::threads::ID gTLSThreadID;
 #ifdef MOZ_ASAN
 // Temporary workaround, see bug 895845
-MOZ_ASAN_BLACKLIST static
+MOZ_ASAN_BLACKLIST bool NS_IsMainThread();
 #else
 inline
-#endif
 bool NS_IsMainThread()
 {
   return gTLSThreadID == mozilla::threads::Main;
 }
+#endif
 #else
 /**
  * Test to see if the current thread is the main thread.
  *
  * @returns true if the current thread is the main thread, and false
  * otherwise.
  */
 extern NS_COM_GLUE bool NS_IsMainThread();
--- a/xpcom/glue/nsThreadUtils.cpp
+++ b/xpcom/glue/nsThreadUtils.cpp
@@ -117,17 +117,25 @@ NS_GetMainThread(nsIThread **result)
 #if defined(MOZILLA_INTERNAL_API) && defined(XP_WIN)
 extern DWORD gTLSThreadIDIndex;
 bool
 NS_IsMainThread()
 {
   return TlsGetValue(gTLSThreadIDIndex) == (void*) mozilla::threads::Main;
 }
 #elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS)
+#ifdef MOZ_ASAN
+// Temporary workaround, see bug 895845
+bool NS_IsMainThread()
+{
+  return gTLSThreadID == mozilla::threads::Main;
+}
+#else
 // NS_IsMainThread() is defined inline in MainThreadUtils.h
+#endif
 #else
 #ifdef MOZILLA_INTERNAL_API
 bool NS_IsMainThread()
 {
   bool result = false;
   nsThreadManager::get()->nsThreadManager::GetIsMainThread(&result);
   return bool(result);
 }