Bug 1372426 - More detailed names for nsInputStreamReadyEvent (r=erahm)

MozReview-Commit-ID: 6beE0eMCxg7
This commit is contained in:
Bill McCloskey 2017-06-12 16:24:15 -07:00
parent 13e936cdab
commit d7df561295
12 changed files with 30 additions and 17 deletions

View File

@ -483,7 +483,8 @@ nsBMPEncoder::NotifyListener()
mNotifyThreshold || mFinished)) {
nsCOMPtr<nsIInputStreamCallback> callback;
if (mCallbackTarget) {
callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
callback = NS_NewInputStreamReadyEvent("nsBMPEncoder::NotifyListener",
mCallback, mCallbackTarget);
} else {
callback = mCallback;
}

View File

@ -442,7 +442,8 @@ nsICOEncoder::NotifyListener()
mImageBufferReadPoint >= mNotifyThreshold || mFinished)) {
nsCOMPtr<nsIInputStreamCallback> callback;
if (mCallbackTarget) {
callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
callback = NS_NewInputStreamReadyEvent("nsICOEncoder::NotifyListener",
mCallback, mCallbackTarget);
} else {
callback = mCallback;
}

View File

@ -515,7 +515,8 @@ nsJPEGEncoder::NotifyListener()
mFinished)) {
nsCOMPtr<nsIInputStreamCallback> callback;
if (mCallbackTarget) {
callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
callback = NS_NewInputStreamReadyEvent("nsJPEGEncoder::NotifyListener",
mCallback, mCallbackTarget);
} else {
callback = mCallback;
}

View File

@ -741,7 +741,8 @@ nsPNGEncoder::NotifyListener()
mFinished)) {
nsCOMPtr<nsIInputStreamCallback> callback;
if (mCallbackTarget) {
callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
callback = NS_NewInputStreamReadyEvent("nsPNGEncoder::NotifyListener",
mCallback, mCallbackTarget);
} else {
callback = mCallback;
}

View File

@ -226,7 +226,8 @@ 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);

View File

@ -19,7 +19,8 @@ nsBaseContentStream::DispatchCallback(bool async)
nsCOMPtr<nsIInputStreamCallback> callback;
if (async) {
callback = NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
callback = NS_NewInputStreamReadyEvent("nsBaseContentStream::DispatchCallback",
mCallback, mCallbackTarget);
mCallback = nullptr;
} else {
callback.swap(mCallback);

View File

@ -486,7 +486,8 @@ nsSocketInputStream::AsyncWait(nsIInputStreamCallback *callback,
//
// build event proxy
//
mCallback = NS_NewInputStreamReadyEvent(callback, target);
mCallback = NS_NewInputStreamReadyEvent("nsSocketInputStream::AsyncWait",
callback, target);
}
else
mCallback = callback;

View File

@ -635,7 +635,8 @@ CacheFileInputStream::NotifyListener()
}
nsCOMPtr<nsIInputStreamCallback> asyncCallback =
NS_NewInputStreamReadyEvent(mCallback, mCallbackTarget);
NS_NewInputStreamReadyEvent("CacheFileInputStream::NotifyListener",
mCallback, mCallbackTarget);
mCallback = nullptr;
mCallbackTarget = nullptr;

View File

@ -212,7 +212,8 @@ void AndroidCameraInputStream::NotifyListeners() {
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;
}

View File

@ -1493,7 +1493,8 @@ nsPipeInputStream::AsyncWait(nsIInputStreamCallback* aCallback,
nsCOMPtr<nsIInputStreamCallback> proxy;
if (aTarget) {
proxy = NS_NewInputStreamReadyEvent(aCallback, aTarget);
proxy = NS_NewInputStreamReadyEvent("nsPipeInputStream::AsyncWait",
aCallback, aTarget);
aCallback = proxy;
}

View File

@ -36,9 +36,10 @@ class nsInputStreamReadyEvent final
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)
{
@ -61,7 +62,7 @@ private:
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);
@ -209,13 +210,14 @@ NS_IMPL_ISUPPORTS_INHERITED(nsOutputStreamReadyEvent, CancelableRunnable,
//-----------------------------------------------------------------------------
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();
}

View File

@ -28,7 +28,8 @@ class nsIEventTarget;
* aTarget parameter is non-null.
*/
extern already_AddRefed<nsIInputStreamCallback>
NS_NewInputStreamReadyEvent(nsIInputStreamCallback* aNotify,
NS_NewInputStreamReadyEvent(const char* aName,
nsIInputStreamCallback* aNotify,
nsIEventTarget* aTarget);
/**