mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1218297 - eventtokenbucket shutdown leak r=valentin
This commit is contained in:
parent
3f8074f84e
commit
a045ede9aa
@ -205,6 +205,18 @@ EventTokenBucket::UnPause()
|
||||
UpdateTimer();
|
||||
}
|
||||
|
||||
void
|
||||
EventTokenBucket::Stop()
|
||||
{
|
||||
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
|
||||
SOCKET_LOG(("EventTokenBucket::Stop %p armed=%d\n", this, mTimerArmed));
|
||||
mStopped = true;
|
||||
if (mTimerArmed) {
|
||||
mTimer->Cancel();
|
||||
mTimerArmed = false;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
EventTokenBucket::SubmitEvent(ATokenBucketEvent *event, nsICancelable **cancelable)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
// credits. ClearCredits can be used before unpausing if desired.
|
||||
void Pause();
|
||||
void UnPause();
|
||||
void Stop() { mStopped = true; }
|
||||
void Stop();
|
||||
|
||||
// The returned cancelable event can only be canceled from the socket thread
|
||||
nsresult SubmitEvent(ATokenBucketEvent *event, nsICancelable **cancelable);
|
||||
|
@ -2308,6 +2308,7 @@ nsHttpConnectionMgr::OnMsgShutdown(int32_t, ARefBase *param)
|
||||
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
|
||||
LOG(("nsHttpConnectionMgr::OnMsgShutdown\n"));
|
||||
|
||||
gHttpHandler->StopRequestTokenBucket();
|
||||
mCT.Enumerate(ShutdownPassCB, this);
|
||||
|
||||
if (mTimeoutTick) {
|
||||
|
@ -29,6 +29,8 @@ class nsISiteSecurityService;
|
||||
class nsIStreamConverterService;
|
||||
class nsITimer;
|
||||
|
||||
extern mozilla::Atomic<PRThread*, mozilla::Relaxed> gSocketThread;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
class ATokenBucketEvent;
|
||||
@ -563,6 +565,7 @@ public:
|
||||
nsresult SubmitPacedRequest(ATokenBucketEvent *event,
|
||||
nsICancelable **cancel)
|
||||
{
|
||||
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
|
||||
if (!mRequestTokenBucket)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
return mRequestTokenBucket->SubmitEvent(event, cancel);
|
||||
@ -571,9 +574,19 @@ public:
|
||||
// Socket thread only
|
||||
void SetRequestTokenBucket(EventTokenBucket *aTokenBucket)
|
||||
{
|
||||
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
|
||||
mRequestTokenBucket = aTokenBucket;
|
||||
}
|
||||
|
||||
void StopRequestTokenBucket()
|
||||
{
|
||||
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
|
||||
if (mRequestTokenBucket) {
|
||||
mRequestTokenBucket->Stop();
|
||||
mRequestTokenBucket = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
RefPtr<Tickler> mWifiTickler;
|
||||
void TickleWifi(nsIInterfaceRequestor *cb);
|
||||
|
Loading…
Reference in New Issue
Block a user