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 |