Bug 1323100 - Remove NS_SetThreadName which is now unused. r?froydnj draft
authorMarkus Stange <mstange@themasta.com>
Tue, 20 Dec 2016 14:43:11 +0100
changeset 456886 16f75b1ed9f65b89a4b8418b7e4a14240a35331d
parent 456885 e31e965d18dccbf9fdc5f98feb8f721139c099f7
child 456887 538c90d86790431b7b96d99a7a32b317c7cc86d0
push id40636
push userbmo:mstange@themasta.com
push dateFri, 06 Jan 2017 12:38:48 +0000
reviewersfroydnj
bugs1323100
milestone53.0a1
Bug 1323100 - Remove NS_SetThreadName which is now unused. r?froydnj MozReview-Commit-ID: 7je5PhV1TsU
xpcom/glue/nsThreadUtils.cpp
xpcom/glue/nsThreadUtils.h
--- a/xpcom/glue/nsThreadUtils.cpp
+++ b/xpcom/glue/nsThreadUtils.cpp
@@ -385,66 +385,16 @@ NS_ProcessNextEvent(nsIThread* aThread, 
     }
     aThread = current.get();
   }
 #endif
   bool val;
   return NS_SUCCEEDED(aThread->ProcessNextEvent(aMayWait, &val)) && val;
 }
 
-#ifndef XPCOM_GLUE_AVOID_NSPR
-
-namespace {
-
-class nsNameThreadRunnable final : public nsIRunnable
-{
-  ~nsNameThreadRunnable() {}
-
-public:
-  explicit nsNameThreadRunnable(const nsACString& aName) : mName(aName) {}
-
-  NS_DECL_THREADSAFE_ISUPPORTS
-  NS_DECL_NSIRUNNABLE
-
-protected:
-  const nsCString mName;
-};
-
-NS_IMPL_ISUPPORTS(nsNameThreadRunnable, nsIRunnable)
-
-NS_IMETHODIMP
-nsNameThreadRunnable::Run()
-{
-  PR_SetCurrentThreadName(mName.BeginReading());
-  return NS_OK;
-}
-
-} // namespace
-
-void
-NS_SetThreadName(nsIThread* aThread, const nsACString& aName)
-{
-  if (!aThread) {
-    return;
-  }
-
-  aThread->Dispatch(new nsNameThreadRunnable(aName),
-                    nsIEventTarget::DISPATCH_NORMAL);
-}
-
-#else // !XPCOM_GLUE_AVOID_NSPR
-
-void
-NS_SetThreadName(nsIThread* aThread, const nsACString& aName)
-{
-  // No NSPR, no love.
-}
-
-#endif
-
 #ifdef MOZILLA_INTERNAL_API
 nsIThread*
 NS_GetCurrentThread()
 {
   return nsThreadManager::get().GetCurrentThread();
 }
 #endif
 
--- a/xpcom/glue/nsThreadUtils.h
+++ b/xpcom/glue/nsThreadUtils.h
@@ -28,34 +28,16 @@
 #include "mozilla/Tuple.h"
 #include "mozilla/TypeTraits.h"
 
 //-----------------------------------------------------------------------------
 // These methods are alternatives to the methods on nsIThreadManager, provided
 // for convenience.
 
 /**
- * Set name of the target thread.  This operation is asynchronous.
- */
-extern void NS_SetThreadName(nsIThread* aThread, const nsACString& aName);
-
-/**
- * Static length version of the above function checking length of the
- * name at compile time.
- */
-template<size_t LEN>
-inline void
-NS_SetThreadName(nsIThread* aThread, const char (&aName)[LEN])
-{
-  static_assert(LEN <= 16,
-                "Thread name must be no more than 16 characters");
-  NS_SetThreadName(aThread, nsDependentCString(aName));
-}
-
-/**
  * Create a new thread, and optionally provide an initial event for the thread.
  *
  * @param aResult
  *   The resulting nsIThread object.
  * @param aInitialEvent
  *   The initial event to run on this thread.  This parameter may be null.
  * @param aStackSize
  *   The size in bytes to reserve for the thread's stack.