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

Side by Side Diff: content/browser/streams/stream_context.cc

Issue 1005683003: favor DCHECK_CURRENTLY_ON for better logs in content/browser/[q-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 18 matching lines...) Expand all
29 BrowserThread::PostTask( 29 BrowserThread::PostTask(
30 BrowserThread::IO, FROM_HERE, 30 BrowserThread::IO, FROM_HERE,
31 base::Bind(&StreamContext::InitializeOnIOThread, stream)); 31 base::Bind(&StreamContext::InitializeOnIOThread, stream));
32 } 32 }
33 } 33 }
34 34
35 return UserDataAdapter<StreamContext>::Get(context, kStreamContextKeyName); 35 return UserDataAdapter<StreamContext>::Get(context, kStreamContextKeyName);
36 } 36 }
37 37
38 void StreamContext::InitializeOnIOThread() { 38 void StreamContext::InitializeOnIOThread() {
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 39 DCHECK_CURRENTLY_ON(BrowserThread::IO);
40 registry_.reset(new StreamRegistry()); 40 registry_.reset(new StreamRegistry());
41 } 41 }
42 42
43 StreamContext::~StreamContext() {} 43 StreamContext::~StreamContext() {}
44 44
45 void StreamContext::DeleteOnCorrectThread() const { 45 void StreamContext::DeleteOnCorrectThread() const {
46 // In many tests, there isn't a valid IO thread. In that case, just delete on 46 // In many tests, there isn't a valid IO thread. In that case, just delete on
47 // the current thread. 47 // the current thread.
48 // TODO(zork): Remove this custom deleter, and fix the leaks in all the 48 // TODO(zork): Remove this custom deleter, and fix the leaks in all the
49 // tests. 49 // tests.
50 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && 50 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) &&
51 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { 51 !BrowserThread::CurrentlyOn(BrowserThread::IO)) {
52 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 52 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
53 return; 53 return;
54 } 54 }
55 delete this; 55 delete this;
56 } 56 }
57 57
58 } // namespace content 58 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/storage_partition_impl.cc ('k') | content/browser/tcmalloc_internals_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698