Commit a33393c6 authored by atwilson@chromium.org's avatar atwilson@chromium.org

Added warning when URLRequestContextGetter leaks.

If URLRequestContextGetter's refcount drops to zero after the IO thread has
already gone away, the object leaks. This can be tricky to track down, so
now we emit a warning message to the logs.

BUG=142702


Review URL: https://chromiumcodereview.appspot.com/10857008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151792 0039d316-1c4b-4281-b951-d872f2087c98
parent 517dedc2
......@@ -22,7 +22,13 @@ void URLRequestContextGetter::OnDestruct() const {
if (network_task_runner->BelongsToCurrentThread()) {
delete this;
} else {
network_task_runner->DeleteSoon(FROM_HERE, this);
if (!network_task_runner->DeleteSoon(FROM_HERE, this)) {
// Can't force-delete the object here, because some derived classes
// can only be deleted on the owning thread, so just emit a warning to
// aid in debugging.
DLOG(WARNING) << "URLRequestContextGetter leaking due to no owning"
<< " thread.";
}
}
}
// If no IO message loop proxy was available, we will just leak memory.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment