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

Unified Diff: chrome/browser/chromeos/cros/cert_library.cc

Issue 9535003: Fix WeakPtr's thread restriction violation in chromeos::CertLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/cert_library.cc
diff --git a/chrome/browser/chromeos/cros/cert_library.cc b/chrome/browser/chromeos/cros/cert_library.cc
index 3674981e754ef13089f908e38f011e76fd40cf55..cae6d3e59f02ad82764d0b8a24e3f85dacf58a9f 100644
--- a/chrome/browser/chromeos/cros/cert_library.cc
+++ b/chrome/browser/chromeos/cros/cert_library.cc
@@ -99,6 +99,9 @@ namespace chromeos {
//////////////////////////////////////////////////////////////////////////////
+// base::Unretained(this) in the class is safe. By the time this object is
+// deleted as part of CrosLibrary, the DB thread and the UI message loop
+// are already terminated.
class CertLibraryImpl
: public CertLibrary,
public net::CertDatabase::Observer {
@@ -239,7 +242,7 @@ class CertLibraryImpl
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE,
base::Bind(&CertLibraryImpl::LoadCertificates,
- weak_ptr_factory_.GetWeakPtr()));
+ base::Unretained(this)));
}
}
@@ -250,7 +253,7 @@ class CertLibraryImpl
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE,
base::Bind(&CertLibraryImpl::LoadCertificates,
- weak_ptr_factory_.GetWeakPtr()));
+ base::Unretained(this)));
}
}
@@ -270,7 +273,7 @@ class CertLibraryImpl
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&CertLibraryImpl::UpdateCertificates,
- weak_ptr_factory_.GetWeakPtr(), cert_list));
+ base::Unretained(this), cert_list));
}
// Comparison functor for locale-sensitive sorting of certificates by name.
@@ -410,8 +413,7 @@ class CertLibraryImpl
// tpm_token_name_ is set, load the certificates on the DB thread.
BrowserThread::PostTask(
BrowserThread::DB, FROM_HERE,
- base::Bind(&CertLibraryImpl::LoadCertificates,
- weak_ptr_factory_.GetWeakPtr()));
+ base::Bind(&CertLibraryImpl::LoadCertificates, base::Unretained(this)));
}
// Observers.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698