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

Side by Side 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: Add 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 unified diff | Download patch
« no previous file with comments | « content/browser/streams/stream_context.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/streams/stream_context.h" 5 #include "content/browser/streams/stream_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/streams/stream_registry.h" 8 #include "content/browser/streams/stream_registry.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 10
(...skipping 23 matching lines...) Expand all
34 return UserDataAdapter<StreamContext>::Get(context, kStreamContextKeyName); 34 return UserDataAdapter<StreamContext>::Get(context, kStreamContextKeyName);
35 } 35 }
36 36
37 void StreamContext::InitializeOnIOThread() { 37 void StreamContext::InitializeOnIOThread() {
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
39 registry_.reset(new StreamRegistry()); 39 registry_.reset(new StreamRegistry());
40 } 40 }
41 41
42 StreamContext::~StreamContext() {} 42 StreamContext::~StreamContext() {}
43 43
44 void StreamContext::DeleteOnCorrectThread() const {
darin (slow to review) 2013/03/11 20:26:41 I'm really not a big fan of test-only code like th
45 // In many tests, there isn't a valid IO thread. In that case, just delete on
46 // the current thread.
47 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) &&
48 !BrowserThread::CurrentlyOn(BrowserThread::IO)) {
49 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
50 return;
51 }
52 delete this;
53 }
54
44 } // namespace content 55 } // namespace content
OLDNEW
« 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