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

Unified Diff: content/browser/streams/stream_context.cc

Issue 12615004: Fix heapcheck errors (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix the comment Created 7 years, 9 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 | « content/browser/streams/stream_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/streams/stream_context.cc
diff --git a/content/browser/streams/stream_context.cc b/content/browser/streams/stream_context.cc
index ca77df1722ce3692f489f9474ebd5751bbe41e8a..ef3a79d11a05eb6d3dd07dbb807c1dca750c1b2c 100644
--- a/content/browser/streams/stream_context.cc
+++ b/content/browser/streams/stream_context.cc
@@ -41,4 +41,17 @@ void StreamContext::InitializeOnIOThread() {
StreamContext::~StreamContext() {}
+void StreamContext::DeleteOnCorrectThread() const {
+ // In many tests, there isn't a valid IO thread. In that case, just delete on
+ // the current thread.
+ // TODO(zork): Remove this custom deleter, and fix the leaks in all the
+ // tests.
+ if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) &&
+ !BrowserThread::CurrentlyOn(BrowserThread::IO)) {
+ BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
+ return;
+ }
+ delete this;
+}
+
} // namespace content
« no previous file with comments | « content/browser/streams/stream_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698