bug 1161253 close pconns on background notification r=bagder

This commit is contained in:
Patrick McManus 2015-05-05 10:10:21 -04:00
parent fd495e095e
commit 3f36d05a87

View File

@ -363,6 +363,7 @@ nsHttpHandler::Init()
mObserverService->AddObserver(this, "webapps-clear-data", true);
mObserverService->AddObserver(this, "browser:purge-session-history", true);
mObserverService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true);
mObserverService->AddObserver(this, "application-background", true);
}
MakeNewRequestTokenBucket();
@ -2010,6 +2011,12 @@ nsHttpHandler::Observe(nsISupports *subject,
mConnMgr->VerifyTraffic();
}
}
} else if (!strcmp(topic, "application-background")) {
// going to the background on android means we should close
// down idle connections for power conservation
if (mConnMgr) {
mConnMgr->DoShiftReloadConnectionCleanup(nullptr);
}
}
return NS_OK;