Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(975)

Unified Diff: net/url_request/url_request_context_getter.cc

Issue 10857008: Added warning when URLRequestContextGetter leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed ref to IO thread. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_context_getter.cc
diff --git a/net/url_request/url_request_context_getter.cc b/net/url_request/url_request_context_getter.cc
index db73fe3705f1e3016ed94993d757e3866c9b65cc..44b7bf4bbbac4d4fc9485a5cf44d20eb9e2b87d1 100644
--- a/net/url_request/url_request_context_getter.cc
+++ b/net/url_request/url_request_context_getter.cc
@@ -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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698