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

Unified Diff: chromeos/cryptohome/system_salt_getter.cc

Issue 34303002: chromeos: Wait for service to be available when getting system salt (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 7 years, 2 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 | « chromeos/cryptohome/system_salt_getter.h ('k') | chromeos/cryptohome/system_salt_getter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/cryptohome/system_salt_getter.cc
diff --git a/chromeos/cryptohome/system_salt_getter.cc b/chromeos/cryptohome/system_salt_getter.cc
index c1390419907528b09d79ccf6d729a92a7a5a0dd8..f299f0f4744f37de6342ce0fbcc179c4c2e00ef5 100644
--- a/chromeos/cryptohome/system_salt_getter.cc
+++ b/chromeos/cryptohome/system_salt_getter.cc
@@ -19,7 +19,7 @@ SystemSaltGetter* g_system_salt_getter = NULL;
} // namespace
-SystemSaltGetter::SystemSaltGetter() {
+SystemSaltGetter::SystemSaltGetter() : weak_ptr_factory_(this) {
}
SystemSaltGetter::~SystemSaltGetter() {
@@ -27,9 +27,10 @@ SystemSaltGetter::~SystemSaltGetter() {
void SystemSaltGetter::GetSystemSalt(
const GetSystemSaltCallback& callback) {
- // TODO(hashimoto): Stop using GetSystemSaltSynt(). crbug.com/141009
- base::MessageLoopProxy::current()->PostTask(
- FROM_HERE, base::Bind(callback, GetSystemSaltSync()));
+ DBusThreadManager::Get()->GetCryptohomeClient()->WaitForServiceToBeAvailable(
+ base::Bind(&SystemSaltGetter::GetSystemSaltInternal,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
}
std::string SystemSaltGetter::GetSystemSaltSync() {
@@ -41,6 +42,14 @@ std::string SystemSaltGetter::GetCachedSystemSalt() {
return system_salt_;
}
+void SystemSaltGetter::GetSystemSaltInternal(
+ const GetSystemSaltCallback& callback,
+ bool service_is_available) {
+ LOG_IF(ERROR, !service_is_available) << "WaitForServiceToBeAvailable failed.";
+ // TODO(hashimoto): Stop using GetSystemSaltSync(). crbug.com/141009
+ callback.Run(GetSystemSaltSync());
+}
+
void SystemSaltGetter::LoadSystemSalt() {
if (!system_salt_.empty())
return;
« no previous file with comments | « chromeos/cryptohome/system_salt_getter.h ('k') | chromeos/cryptohome/system_salt_getter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698