Cleanup destruction of URLRequestContextGetter (#12305)

- Add Leak detector
 - Indicate shutdown of request context from Browser Context
 - Change stored references to URLRequestContextGetter to use BrowserContext
 - Destroy session properties explicitly
This commit is contained in:
Robo 2018-03-30 18:54:55 +05:30 committed by Charles Kerr
parent fc00a2ba32
commit 171230e45d
14 changed files with 144 additions and 96 deletions

View file

@ -110,10 +110,9 @@ int AtomBrowserMainParts::GetExitCode() {
return exit_code_ != nullptr ? *exit_code_ : 0;
}
base::Closure AtomBrowserMainParts::RegisterDestructionCallback(
const base::Closure& callback) {
auto iter = destructors_.insert(destructors_.end(), callback);
return base::Bind(&Erase<std::list<base::Closure>>, &destructors_, iter);
void AtomBrowserMainParts::RegisterDestructionCallback(
base::OnceClosure callback) {
destructors_.insert(destructors_.end(), std::move(callback));
}
void AtomBrowserMainParts::PreEarlyInitialization() {
@ -242,9 +241,10 @@ void AtomBrowserMainParts::PostMainMessageLoopRun() {
// We don't use ranged for loop because iterators are getting invalided when
// the callback runs.
for (auto iter = destructors_.begin(); iter != destructors_.end();) {
base::Closure& callback = *iter;
base::OnceClosure callback = std::move(*iter);
if (!callback.is_null())
std::move(callback).Run();
++iter;
callback.Run();
}
}