From d5a1528ea48a251195b02b18b85027d8f5fc1323 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Wed, 6 Jun 2001 02:34:52 +0000 Subject: [PATCH] simply adding some logging helpful for debugging event queue interactions. from bugscape bug 4890, bugzilla bug 84247 r=darin --- netwerk/base/src/nsRequestObserverProxy.cpp | 4 ++++ netwerk/base/src/nsRequestObserverProxy.h | 4 ++++ netwerk/base/src/nsStreamListenerProxy.cpp | 3 +++ 3 files changed, 11 insertions(+) diff --git a/netwerk/base/src/nsRequestObserverProxy.cpp b/netwerk/base/src/nsRequestObserverProxy.cpp index 50bfbba75ac..f73178df724 100644 --- a/netwerk/base/src/nsRequestObserverProxy.cpp +++ b/netwerk/base/src/nsRequestObserverProxy.cpp @@ -105,6 +105,7 @@ public: return; } + LOG(("handle startevent=%8lX\n",(long)this)); nsresult rv = mProxy->mObserver->OnStartRequest(mRequest, mContext); if (NS_FAILED(rv)) { LOG(("OnStartRequest failed [rv=%x] canceling request!\n", rv)); @@ -155,6 +156,7 @@ public: rv = mRequest->GetStatus(&status); NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed for request!"); + LOG(("handle stopevent=%8lX\n",(long)this)); (void) observer->OnStopRequest(mRequest, mContext, status); } }; @@ -182,6 +184,7 @@ nsRequestObserverProxy::OnStartRequest(nsIRequest *request, if (!ev) return NS_ERROR_OUT_OF_MEMORY; + LOG(("post startevent=%8lX queue=%8lX\n",(long)ev,(long)mEventQ.get())); nsresult rv = FireEvent(ev); if (NS_FAILED(rv)) delete ev; @@ -206,6 +209,7 @@ nsRequestObserverProxy::OnStopRequest(nsIRequest *request, if (!ev) return NS_ERROR_OUT_OF_MEMORY; + LOG(("post stopevent=%8lX queue=%8lX\n",(long)ev,(long)mEventQ.get())); nsresult rv = FireEvent(ev); if (NS_FAILED(rv)) delete ev; diff --git a/netwerk/base/src/nsRequestObserverProxy.h b/netwerk/base/src/nsRequestObserverProxy.h index 9abe6234568..1a1741cca94 100644 --- a/netwerk/base/src/nsRequestObserverProxy.h +++ b/netwerk/base/src/nsRequestObserverProxy.h @@ -45,6 +45,10 @@ public: nsIRequestObserver *Observer() { return mObserver; } nsresult FireEvent(nsARequestObserverEvent *); +#ifdef DEBUG + nsIEventQueue *GetEventQueue() + { return mEventQ.get(); } // debugging-only; no addref +#endif nsresult SetEventQueue(nsIEventQueue *); protected: diff --git a/netwerk/base/src/nsStreamListenerProxy.cpp b/netwerk/base/src/nsStreamListenerProxy.cpp index 4acde6ec9e6..612789093ca 100644 --- a/netwerk/base/src/nsStreamListenerProxy.cpp +++ b/netwerk/base/src/nsStreamListenerProxy.cpp @@ -167,6 +167,8 @@ nsOnDataAvailableEvent::HandleEvent() nsCOMPtr listener; rv = mProxy->GetListener(getter_AddRefs(listener)); + LOG(("handle dataevent=%8lX\n",(long)this)); + // Forward call to listener if (listener) rv = listener->OnDataAvailable(mRequest, mContext, @@ -324,6 +326,7 @@ nsStreamListenerProxy::OnDataAvailable(nsIRequest *request, if (!ev) return NS_ERROR_OUT_OF_MEMORY; // Reuse the event queue of the observer proxy + LOG(("post dataevent=%8lX queue=%8lX\n",(long)ev,(long)mObserverProxy->GetEventQueue())); rv = mObserverProxy->FireEvent(ev); if (NS_FAILED(rv)) delete ev;