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

Side by Side Diff: chrome/browser/net/nss_context_linux.cc

Issue 1117613003: [chrome/browser/net] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « chrome/browser/net/nss_context_chromeos.cc ('k') | chrome/browser/net/prediction_options.cc » ('j') | 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 "chrome/browser/net/nss_context.h" 5 #include "chrome/browser/net/nss_context.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "crypto/nss_util_internal.h" 8 #include "crypto/nss_util_internal.h"
9 #include "net/cert/nss_cert_database.h" 9 #include "net/cert/nss_cert_database.h"
10 10
11 namespace { 11 namespace {
12 net::NSSCertDatabase* g_nss_cert_database = NULL; 12 net::NSSCertDatabase* g_nss_cert_database = NULL;
13 } // namespace 13 } // namespace
14 14
15 crypto::ScopedPK11Slot GetPublicNSSKeySlotForResourceContext( 15 crypto::ScopedPK11Slot GetPublicNSSKeySlotForResourceContext(
16 content::ResourceContext* context) { 16 content::ResourceContext* context) {
17 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 17 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
18 return crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot()); 18 return crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot());
19 } 19 }
20 20
21 crypto::ScopedPK11Slot GetPrivateNSSKeySlotForResourceContext( 21 crypto::ScopedPK11Slot GetPrivateNSSKeySlotForResourceContext(
22 content::ResourceContext* context, 22 content::ResourceContext* context,
23 const base::Callback<void(crypto::ScopedPK11Slot)>& callback) { 23 const base::Callback<void(crypto::ScopedPK11Slot)>& callback) {
24 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 24 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
25 return crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot()); 25 return crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot());
26 } 26 }
27 27
28 net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext( 28 net::NSSCertDatabase* GetNSSCertDatabaseForResourceContext(
29 content::ResourceContext* context, 29 content::ResourceContext* context,
30 const base::Callback<void(net::NSSCertDatabase*)>& callback) { 30 const base::Callback<void(net::NSSCertDatabase*)>& callback) {
31 // This initialization is not thread safe. This CHECK ensures that this code 31 // This initialization is not thread safe. This CHECK ensures that this code
32 // is only run on a single thread. 32 // is only run on a single thread.
33 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 33 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
34 if (!g_nss_cert_database) { 34 if (!g_nss_cert_database) {
35 // Linux has only a single persistent slot compared to ChromeOS's separate 35 // Linux has only a single persistent slot compared to ChromeOS's separate
36 // public and private slot. 36 // public and private slot.
37 // Redirect any slot usage to this persistent slot on Linux. 37 // Redirect any slot usage to this persistent slot on Linux.
38 g_nss_cert_database = new net::NSSCertDatabase( 38 g_nss_cert_database = new net::NSSCertDatabase(
39 crypto::ScopedPK11Slot( 39 crypto::ScopedPK11Slot(
40 crypto::GetPersistentNSSKeySlot()) /* public slot */, 40 crypto::GetPersistentNSSKeySlot()) /* public slot */,
41 crypto::ScopedPK11Slot( 41 crypto::ScopedPK11Slot(
42 crypto::GetPersistentNSSKeySlot()) /* private slot */); 42 crypto::GetPersistentNSSKeySlot()) /* private slot */);
43 } 43 }
44 return g_nss_cert_database; 44 return g_nss_cert_database;
45 } 45 }
OLDNEW
« no previous file with comments | « chrome/browser/net/nss_context_chromeos.cc ('k') | chrome/browser/net/prediction_options.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698