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

Unified Diff: chrome/browser/chromeos/policy/enterprise_install_attributes.cc

Issue 2244443002: chromeos: Avoid cryptohome D-Bus log spam at boot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set consistency_check_running_ from Init() Created 4 years, 3 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 | « chrome/browser/chromeos/policy/enterprise_install_attributes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/enterprise_install_attributes.cc
diff --git a/chrome/browser/chromeos/policy/enterprise_install_attributes.cc b/chrome/browser/chromeos/policy/enterprise_install_attributes.cc
index 3da20c84680bc2f69a764edf00c5dd55d15edcc5..1444067a980a1801c286c3979f47e21f948003e7 100644
--- a/chrome/browser/chromeos/policy/enterprise_install_attributes.cc
+++ b/chrome/browser/chromeos/policy/enterprise_install_attributes.cc
@@ -79,11 +79,15 @@ EnterpriseInstallAttributes::EnterpriseInstallAttributes(
EnterpriseInstallAttributes::~EnterpriseInstallAttributes() {}
void EnterpriseInstallAttributes::Init(const base::FilePath& cache_file) {
- DCHECK_EQ(false, device_locked_);
+ DCHECK(!device_locked_);
- // The actual check happens asynchronously, thus it is ok to trigger it before
- // Init() has completed.
- TriggerConsistencyCheck(kDbusRetryCount * kDbusRetryIntervalInSeconds);
+ // Mark the consistency check as running to ensure that LockDevice() is
+ // blocked, but wait for the cryptohome service to be available before
+ // actually calling TriggerConsistencyCheck().
+ consistency_check_running_ = true;
+ cryptohome_client_->WaitForServiceToBeAvailable(base::Bind(
+ &EnterpriseInstallAttributes::OnCryptohomeServiceInitiallyAvailable,
+ weak_ptr_factory_.GetWeakPtr()));
if (!base::PathExists(cache_file))
return;
@@ -356,7 +360,6 @@ DeviceMode EnterpriseInstallAttributes::GetMode() {
}
void EnterpriseInstallAttributes::TriggerConsistencyCheck(int dbus_retries) {
- consistency_check_running_ = true;
cryptohome_client_->TpmIsOwned(
base::Bind(&EnterpriseInstallAttributes::OnTpmOwnerCheckCompleted,
weak_ptr_factory_.GetWeakPtr(),
@@ -418,6 +421,16 @@ const char EnterpriseInstallAttributes::kAttrEnterpriseUser[] =
const char EnterpriseInstallAttributes::kAttrConsumerKioskEnabled[] =
"consumer.app_kiosk_enabled";
+void EnterpriseInstallAttributes::OnCryptohomeServiceInitiallyAvailable(
+ bool service_is_ready) {
+ if (!service_is_ready)
+ LOG(ERROR) << "Failed waiting for cryptohome D-Bus service availability";
Thiemo Nagel 2016/09/16 03:22:06 Nit: I'd suggest ending sentence with a period.
Daniel Erat 2016/09/16 15:25:51 chrome appears to lean slightly more in the direct
+
+ // Start the consistency check even if we failed to wait for availability;
+ // hopefully the service will become available eventually.
+ TriggerConsistencyCheck(kDbusRetryCount);
+}
+
std::string EnterpriseInstallAttributes::GetDeviceModeString(DeviceMode mode) {
switch (mode) {
case DEVICE_MODE_CONSUMER:
« no previous file with comments | « chrome/browser/chromeos/policy/enterprise_install_attributes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698