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

Side by Side Diff: net/cert/nss_cert_database.cc

Issue 877993003: Pass FROM_HERE to ObserverListThreadSafe::Notify to improve profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « net/cert/cert_database_android.cc ('k') | remoting/host/linux/audio_pipe_reader.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/cert/nss_cert_database.h" 5 #include "net/cert/nss_cert_database.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <certdb.h> 8 #include <certdb.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <pk11pub.h> 10 #include <pk11pub.h>
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 void NSSCertDatabase::NotifyCertRemovalAndCallBack( 431 void NSSCertDatabase::NotifyCertRemovalAndCallBack(
432 scoped_refptr<X509Certificate> cert, 432 scoped_refptr<X509Certificate> cert,
433 const DeleteCertCallback& callback, 433 const DeleteCertCallback& callback,
434 bool success) { 434 bool success) {
435 if (success) 435 if (success)
436 NotifyObserversOfCertRemoved(cert.get()); 436 NotifyObserversOfCertRemoved(cert.get());
437 callback.Run(success); 437 callback.Run(success);
438 } 438 }
439 439
440 void NSSCertDatabase::NotifyObserversOfCertAdded(const X509Certificate* cert) { 440 void NSSCertDatabase::NotifyObserversOfCertAdded(const X509Certificate* cert) {
441 observer_list_->Notify(&Observer::OnCertAdded, make_scoped_refptr(cert)); 441 observer_list_->Notify(FROM_HERE, &Observer::OnCertAdded,
442 make_scoped_refptr(cert));
442 } 443 }
443 444
444 void NSSCertDatabase::NotifyObserversOfCertRemoved( 445 void NSSCertDatabase::NotifyObserversOfCertRemoved(
445 const X509Certificate* cert) { 446 const X509Certificate* cert) {
446 observer_list_->Notify(&Observer::OnCertRemoved, make_scoped_refptr(cert)); 447 observer_list_->Notify(FROM_HERE, &Observer::OnCertRemoved,
448 make_scoped_refptr(cert));
447 } 449 }
448 450
449 void NSSCertDatabase::NotifyObserversOfCACertChanged( 451 void NSSCertDatabase::NotifyObserversOfCACertChanged(
450 const X509Certificate* cert) { 452 const X509Certificate* cert) {
451 observer_list_->Notify( 453 observer_list_->Notify(FROM_HERE, &Observer::OnCACertChanged,
452 &Observer::OnCACertChanged, make_scoped_refptr(cert)); 454 make_scoped_refptr(cert));
453 } 455 }
454 456
455 // static 457 // static
456 bool NSSCertDatabase::DeleteCertAndKeyImpl( 458 bool NSSCertDatabase::DeleteCertAndKeyImpl(
457 scoped_refptr<X509Certificate> cert) { 459 scoped_refptr<X509Certificate> cert) {
458 // For some reason, PK11_DeleteTokenCertAndKey only calls 460 // For some reason, PK11_DeleteTokenCertAndKey only calls
459 // SEC_DeletePermCertificate if the private key is found. So, we check 461 // SEC_DeletePermCertificate if the private key is found. So, we check
460 // whether a private key exists before deciding which function to call to 462 // whether a private key exists before deciding which function to call to
461 // delete the cert. 463 // delete the cert.
462 SECKEYPrivateKey* privKey = 464 SECKEYPrivateKey* privKey =
463 PK11_FindKeyByAnyCert(cert->os_cert_handle(), NULL); 465 PK11_FindKeyByAnyCert(cert->os_cert_handle(), NULL);
464 if (privKey) { 466 if (privKey) {
465 SECKEY_DestroyPrivateKey(privKey); 467 SECKEY_DestroyPrivateKey(privKey);
466 if (PK11_DeleteTokenCertAndKey(cert->os_cert_handle(), NULL)) { 468 if (PK11_DeleteTokenCertAndKey(cert->os_cert_handle(), NULL)) {
467 LOG(ERROR) << "PK11_DeleteTokenCertAndKey failed: " << PORT_GetError(); 469 LOG(ERROR) << "PK11_DeleteTokenCertAndKey failed: " << PORT_GetError();
468 return false; 470 return false;
469 } 471 }
470 } else { 472 } else {
471 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { 473 if (SEC_DeletePermCertificate(cert->os_cert_handle())) {
472 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); 474 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError();
473 return false; 475 return false;
474 } 476 }
475 } 477 }
476 return true; 478 return true;
477 } 479 }
478 480
479 } // namespace net 481 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/cert_database_android.cc ('k') | remoting/host/linux/audio_pipe_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698