Fix WeakPtr's thread restriction violation in chromeos::CertLibrary

BUG=116202
TEST=Login success


Review URL: http://codereview.chromium.org/9535003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124374 0039d316-1c4b-4281-b951-d872f2087c98
parent f24c2262
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment