Bug 1372426 - More detailed names for nsInputStreamReadyEvent (r=erahm)
authorBill McCloskey <billm@mozilla.com>
Mon, 12 Jun 2017 16:24:15 -0700
changeset 364108 dfee29c06556ebe2f4ac43cf0744be9e93390d1d
parent 364107 13c27668f2d7c166bb46af2cd0b9c3a5642f428d
child 364109 db8a48dae370605e2b6de21326f882ef839401fd
push id32033
push userarchaeopteryx@coole-files.de
push dateThu, 15 Jun 2017 18:12:50 +0000
treeherdermozilla-central@75be6742abb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1372426
milestone56.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 1372426 - More detailed names for nsInputStreamReadyEvent (r=erahm) MozReview-Commit-ID: 6beE0eMCxg7
image/encoders/bmp/nsBMPEncoder.cpp
image/encoders/ico/nsICOEncoder.cpp
image/encoders/jpeg/nsJPEGEncoder.cpp
image/encoders/png/nsPNGEncoder.cpp
netwerk/base/ThrottleQueue.cpp
netwerk/base/nsBaseContentStream.cpp
netwerk/base/nsSocketTransport2.cpp
netwerk/cache2/CacheFileInputStream.cpp
netwerk/protocol/device/AndroidCaptureProvider.cpp
xpcom/io/nsPipe3.cpp
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStreamUtils.h
--- a/image/encoders/bmp/nsBMPEncoder.cpp
+++ b/image/encoders/bmp/nsBMPEncoder.cpp
@@ -478,17 +478,18 @@ nsBMPEncoder::ConvertHostARGBRow(const u
 void
 nsBMPEncoder::NotifyListener()
 {
   if (mCallback &&
       (GetCurrentImageBufferOffset() - mImageBufferReadPoint >=
        mNotifyThreshold || mFinished)) {
     nsCOMPtr<nsIInputStreamCallback> callback;
     if (mCallbackTarget) {
-      callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+      callback = NS_NewInputStreamReadyEvent("nsBMPEncoder::NotifyListener",
+                                             mCallback, mCallbackTarget);
     } else {
       callback = mCallback;
     }
 
     NS_ASSERTION(callback, "Shouldn't fail to make the callback");
     // Null the callback first because OnInputStreamReady could
     // reenter AsyncWait
     mCallback = nullptr;
--- a/image/encoders/ico/nsICOEncoder.cpp
+++ b/image/encoders/ico/nsICOEncoder.cpp
@@ -437,17 +437,18 @@ nsICOEncoder::CloseWithStatus(nsresult a
 void
 nsICOEncoder::NotifyListener()
 {
   if (mCallback &&
       (GetCurrentImageBufferOffset() -
          mImageBufferReadPoint >= mNotifyThreshold || mFinished)) {
     nsCOMPtr<nsIInputStreamCallback> callback;
     if (mCallbackTarget) {
-      callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+      callback = NS_NewInputStreamReadyEvent("nsICOEncoder::NotifyListener",
+                                             mCallback, mCallbackTarget);
     } else {
       callback = mCallback;
     }
 
     NS_ASSERTION(callback, "Shouldn't fail to make the callback");
     // Null the callback first because OnInputStreamReady could reenter
     // AsyncWait
     mCallback = nullptr;
--- a/image/encoders/jpeg/nsJPEGEncoder.cpp
+++ b/image/encoders/jpeg/nsJPEGEncoder.cpp
@@ -510,17 +510,18 @@ nsJPEGEncoder::NotifyListener()
   // image).
   ReentrantMonitorAutoEnter autoEnter(mReentrantMonitor);
 
   if (mCallback &&
       (mImageBufferUsed - mImageBufferReadPoint >= mNotifyThreshold ||
        mFinished)) {
     nsCOMPtr<nsIInputStreamCallback> callback;
     if (mCallbackTarget) {
-      callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+      callback = NS_NewInputStreamReadyEvent("nsJPEGEncoder::NotifyListener",
+                                             mCallback, mCallbackTarget);
     } else {
       callback = mCallback;
     }
 
     NS_ASSERTION(callback, "Shouldn't fail to make the callback");
     // Null the callback first because OnInputStreamReady could reenter
     // AsyncWait
     mCallback = nullptr;
--- a/image/encoders/png/nsPNGEncoder.cpp
+++ b/image/encoders/png/nsPNGEncoder.cpp
@@ -736,17 +736,18 @@ nsPNGEncoder::NotifyListener()
   // image).
   ReentrantMonitorAutoEnter autoEnter(mReentrantMonitor);
 
   if (mCallback &&
       (mImageBufferUsed - mImageBufferReadPoint >= mNotifyThreshold ||
        mFinished)) {
     nsCOMPtr<nsIInputStreamCallback> callback;
     if (mCallbackTarget) {
-      callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+      callback = NS_NewInputStreamReadyEvent("nsPNGEncoder::NotifyListener",
+                                             mCallback, mCallbackTarget);
     } else {
       callback = mCallback;
     }
 
     NS_ASSERTION(callback, "Shouldn't fail to make the callback");
     // Null the callback first because OnInputStreamReady could reenter
     // AsyncWait
     mCallback = nullptr;
--- a/netwerk/base/ThrottleQueue.cpp
+++ b/netwerk/base/ThrottleQueue.cpp
@@ -221,17 +221,18 @@ ThrottleInputStream::AsyncWait(nsIInputS
   return NS_OK;
 }
 
 void
 ThrottleInputStream::AllowInput()
 {
   MOZ_ASSERT(mCallback);
   nsCOMPtr<nsIInputStreamCallback> callbackEvent =
-    NS_NewInputStreamReadyEvent(mCallback, mEventTarget);
+    NS_NewInputStreamReadyEvent("ThrottleInputStream::AllowInput",
+                                mCallback, mEventTarget);
   mCallback = nullptr;
   mEventTarget = nullptr;
   callbackEvent->OnInputStreamReady(this);
 }
 
 //-----------------------------------------------------------------------------
 
 NS_IMPL_ISUPPORTS(ThrottleQueue, nsIInputChannelThrottleQueue, nsITimerCallback)
--- a/netwerk/base/nsBaseContentStream.cpp
+++ b/netwerk/base/nsBaseContentStream.cpp
@@ -14,17 +14,18 @@ nsBaseContentStream::DispatchCallback(bo
   if (!mCallback)
     return;
 
   // It's important to clear mCallback and mCallbackTarget up-front because the
   // OnInputStreamReady implementation may call our AsyncWait method.
 
   nsCOMPtr<nsIInputStreamCallback> callback;
   if (async) {
-    callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+      callback = NS_NewInputStreamReadyEvent("nsBaseContentStream::DispatchCallback",
+                                             mCallback, mCallbackTarget);
     mCallback = nullptr;
   } else {
     callback.swap(mCallback);
   }
   mCallbackTarget = nullptr;
 
   callback->OnInputStreamReady(this);
 }
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -481,17 +481,18 @@ nsSocketInputStream::AsyncWait(nsIInputS
     bool hasError = false;
     {
         MutexAutoLock lock(mTransport->mLock);
 
         if (callback && target) {
             //
             // build event proxy
             //
-            mCallback = NS_NewInputStreamReadyEvent(callback, target);
+            mCallback = NS_NewInputStreamReadyEvent("nsSocketInputStream::AsyncWait",
+                                                    callback, target);
         }
         else
             mCallback = callback;
         mCallbackFlags = flags;
 
         hasError = NS_FAILED(mCondition);
     } // unlock mTransport->mLock
 
--- a/netwerk/cache2/CacheFileInputStream.cpp
+++ b/netwerk/cache2/CacheFileInputStream.cpp
@@ -630,17 +630,18 @@ CacheFileInputStream::NotifyListener()
     if (!mCallbackTarget) {
       LOG(("CacheFileInputStream::NotifyListener() - Cannot get Cache I/O "
            "thread! Using main thread for callback."));
       mCallbackTarget = GetMainThreadEventTarget();
     }
   }
 
   nsCOMPtr<nsIInputStreamCallback> asyncCallback =
-    NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+    NS_NewInputStreamReadyEvent("CacheFileInputStream::NotifyListener",
+                                mCallback, mCallbackTarget);
 
   mCallback = nullptr;
   mCallbackTarget = nullptr;
 
   asyncCallback->OnInputStreamReady(this);
 }
 
 void
--- a/netwerk/protocol/device/AndroidCaptureProvider.cpp
+++ b/netwerk/protocol/device/AndroidCaptureProvider.cpp
@@ -207,17 +207,18 @@ void AndroidCameraInputStream::doClose()
 
 
 void AndroidCameraInputStream::NotifyListeners() {
   mozilla::ReentrantMonitorAutoEnter autoMonitor(mMonitor);
   
   if (mCallback && (mAvailable > sizeof(RawVideoHeader))) {
     nsCOMPtr<nsIInputStreamCallback> callback;
     if (mCallbackTarget) {
-      callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
+      callback = NS_NewInputStreamReadyEvent("AndroidCameraInputStream::NotifyListeners",
+                                             mCallback, mCallbackTarget);
     } else {
       callback = mCallback;
     }
 
     NS_ASSERTION(callback, "Shouldn't fail to make the callback!");
 
     // Null the callback first because OnInputStreamReady may reenter AsyncWait
     mCallback = nullptr;
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -1488,17 +1488,18 @@ nsPipeInputStream::AsyncWait(nsIInputStr
     mCallbackFlags = 0;
 
     if (!aCallback) {
       return NS_OK;
     }
 
     nsCOMPtr<nsIInputStreamCallback> proxy;
     if (aTarget) {
-      proxy = NS_NewInputStreamReadyEvent(aCallback, aTarget);
+      proxy = NS_NewInputStreamReadyEvent("nsPipeInputStream::AsyncWait",
+                                          aCallback, aTarget);
       aCallback = proxy;
     }
 
     if (NS_FAILED(Status(mon)) ||
        (mReadState.mAvailable && !(aFlags & WAIT_CLOSURE_ONLY))) {
       // stream is already closed or readable; post event.
       pipeEvents.NotifyInputReady(this, aCallback);
     } else {
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -31,19 +31,20 @@ using namespace mozilla;
 // instead of Run().
 class nsInputStreamReadyEvent final
   : public CancelableRunnable
   , public nsIInputStreamCallback
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
-  nsInputStreamReadyEvent(nsIInputStreamCallback* aCallback,
-                          nsIEventTarget* aTarget)
-    : CancelableRunnable("nsInputStreamReadyEvent")
+    nsInputStreamReadyEvent(const char* aName,
+                            nsIInputStreamCallback* aCallback,
+                            nsIEventTarget* aTarget)
+    : CancelableRunnable(aName)
     , mCallback(aCallback)
     , mTarget(aTarget)
   {
   }
 
 private:
   ~nsInputStreamReadyEvent()
   {
@@ -56,17 +57,17 @@ private:
     // calling thread, then we are ok.  otherwise, we have to try to
     // proxy the Release over the right thread.  if that thread is dead,
     // then there's nothing we can do... better to leak than crash.
     //
     bool val;
     nsresult rv = mTarget->IsOnCurrentThread(&val);
     if (NS_FAILED(rv) || !val) {
       nsCOMPtr<nsIInputStreamCallback> event =
-        NS_NewInputStreamReadyEvent(mCallback, mTarget);
+        NS_NewInputStreamReadyEvent("~nsInputStreamReadyEvent", mCallback, mTarget);
       mCallback = nullptr;
       if (event) {
         rv = event->OnInputStreamReady(nullptr);
         if (NS_FAILED(rv)) {
           NS_NOTREACHED("leaking stream event");
           nsISupports* sup = event;
           NS_ADDREF(sup);
         }
@@ -204,23 +205,24 @@ private:
 };
 
 NS_IMPL_ISUPPORTS_INHERITED(nsOutputStreamReadyEvent, CancelableRunnable,
                             nsIOutputStreamCallback)
 
 //-----------------------------------------------------------------------------
 
 already_AddRefed<nsIInputStreamCallback>
-NS_NewInputStreamReadyEvent(nsIInputStreamCallback* aCallback,
+NS_NewInputStreamReadyEvent(const char* aName,
+                            nsIInputStreamCallback* aCallback,
                             nsIEventTarget* aTarget)
 {
   NS_ASSERTION(aCallback, "null callback");
   NS_ASSERTION(aTarget, "null target");
   RefPtr<nsInputStreamReadyEvent> ev =
-    new nsInputStreamReadyEvent(aCallback, aTarget);
+    new nsInputStreamReadyEvent(aName, aCallback, aTarget);
   return ev.forget();
 }
 
 already_AddRefed<nsIOutputStreamCallback>
 NS_NewOutputStreamReadyEvent(nsIOutputStreamCallback* aCallback,
                              nsIEventTarget* aTarget)
 {
   NS_ASSERTION(aCallback, "null callback");
--- a/xpcom/io/nsStreamUtils.h
+++ b/xpcom/io/nsStreamUtils.h
@@ -23,17 +23,18 @@ class nsIEventTarget;
  * proxy object ensures that the real notify object will be free'd on the
  * thread corresponding to the given event target regardless of what thread
  * the proxy object is destroyed on.
  *
  * This function is designed to be used to implement AsyncWait when the
  * aTarget parameter is non-null.
  */
 extern already_AddRefed<nsIInputStreamCallback>
-NS_NewInputStreamReadyEvent(nsIInputStreamCallback* aNotify,
+NS_NewInputStreamReadyEvent(const char* aName,
+                            nsIInputStreamCallback* aNotify,
                             nsIEventTarget* aTarget);
 
 /**
  * A "one-shot" proxy of the OnOutputStreamReady callback.  The resulting
  * proxy object's OnOutputStreamReady function may only be called once!  The
  * proxy object ensures that the real notify object will be free'd on the
  * thread corresponding to the given event target regardless of what thread
  * the proxy object is destroyed on.