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

Unified Diff: chromeos/dbus/system_clock_client.cc

Issue 2236713002: chromeos: Don't spam logs with tlsdate D-Bus errors at boot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update for only being notified once about availability Created 4 years, 4 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/dbus/system_clock_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/system_clock_client.cc
diff --git a/chromeos/dbus/system_clock_client.cc b/chromeos/dbus/system_clock_client.cc
index 047a29c1c2e7c3b0df46fb1dabaaa5e3a4b74ee8..600536d54953b6b79207ef73f2a53c9c21048211 100644
--- a/chromeos/dbus/system_clock_client.cc
+++ b/chromeos/dbus/system_clock_client.cc
@@ -23,7 +23,7 @@ class SystemClockClientImpl : public SystemClockClient {
SystemClockClientImpl()
: can_set_time_(false),
can_set_time_initialized_(false),
- system_clock_proxy_(NULL),
+ system_clock_proxy_(nullptr),
weak_ptr_factory_(this) {}
~SystemClockClientImpl() override {}
@@ -58,11 +58,6 @@ class SystemClockClientImpl : public SystemClockClient {
system_clock_proxy_ = bus->GetObjectProxy(
system_clock::kSystemClockServiceName,
dbus::ObjectPath(system_clock::kSystemClockServicePath));
-
- // Check whether the system clock can be set.
- GetCanSet();
-
- // Monitor the D-Bus signal for TimeUpdated changes.
system_clock_proxy_->ConnectToSignal(
system_clock::kSystemClockInterface,
system_clock::kSystemClockUpdated,
@@ -70,9 +65,21 @@ class SystemClockClientImpl : public SystemClockClient {
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&SystemClockClientImpl::TimeUpdatedConnected,
weak_ptr_factory_.GetWeakPtr()));
+ system_clock_proxy_->WaitForServiceToBeAvailable(
+ base::Bind(&SystemClockClientImpl::ServiceInitiallyAvailable,
+ weak_ptr_factory_.GetWeakPtr()));
}
private:
+ // Called once when the service initially becomes available (or immediately if
+ // it's already available).
+ void ServiceInitiallyAvailable(bool service_is_available) {
+ if (service_is_available)
+ GetCanSet();
+ else
+ LOG(ERROR) << "Failed to wait for D-Bus service availability";
+ }
+
// Called when a TimeUpdated signal is received.
void TimeUpdatedReceived(dbus::Signal* signal) {
VLOG(1) << "TimeUpdated signal received: " << signal->ToString();
@@ -122,8 +129,7 @@ class SystemClockClientImpl : public SystemClockClient {
system_clock::kSystemClockCanSet);
dbus::MessageWriter writer(&method_call);
system_clock_proxy_->CallMethod(
- &method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&SystemClockClientImpl::OnGetCanSet,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -140,22 +146,11 @@ class SystemClockClientImpl : public SystemClockClient {
DISALLOW_COPY_AND_ASSIGN(SystemClockClientImpl);
};
-void SystemClockClient::Observer::SystemClockUpdated() {
-}
-
-void SystemClockClient::Observer::SystemClockCanSetTimeChanged(
- bool can_set_time) {
-}
-
-SystemClockClient::SystemClockClient() {
-}
-
-SystemClockClient::~SystemClockClient() {
-}
-
// static
SystemClockClient* SystemClockClient::Create() {
return new SystemClockClientImpl();
}
+SystemClockClient::SystemClockClient() {}
+
} // namespace chromeos
« no previous file with comments | « chromeos/dbus/system_clock_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698