Chromium Code Reviews| Index: chromeos/dbus/update_engine_client.cc |
| diff --git a/chromeos/dbus/update_engine_client.cc b/chromeos/dbus/update_engine_client.cc |
| index bb78f668cf0fdde73db7df32f731636093549806..2abd1b02ab316b2b58f840494d02327486be7447 100644 |
| --- a/chromeos/dbus/update_engine_client.cc |
| +++ b/chromeos/dbus/update_engine_client.cc |
| @@ -223,10 +223,6 @@ class UpdateEngineClientImpl : public UpdateEngineClient { |
| update_engine_proxy_ = bus->GetObjectProxy( |
| update_engine::kUpdateEngineServiceName, |
| dbus::ObjectPath(update_engine::kUpdateEngineServicePath)); |
| - |
| - // Monitor the D-Bus signal for brightness changes. Only the power |
| - // manager knows the actual brightness level. We don't cache the |
| - // brightness level in Chrome as it will make things less reliable. |
|
Daniel Erat
2016/08/10 21:56:18
hmm, i wonder where this code was copy-and-pasted
stevenjb
2016/08/10 22:24:21
Heh.
|
| update_engine_proxy_->ConnectToSignal( |
| update_engine::kUpdateEngineInterface, |
| update_engine::kStatusUpdate, |
| @@ -234,15 +230,22 @@ class UpdateEngineClientImpl : public UpdateEngineClient { |
| weak_ptr_factory_.GetWeakPtr()), |
| base::Bind(&UpdateEngineClientImpl::StatusUpdateConnected, |
| weak_ptr_factory_.GetWeakPtr())); |
| - |
| - // Get update engine status for the initial status. Update engine won't |
| - // send StatusUpdate signal unless there is a status change. If chrome |
| - // crashes after UPDATE_STATUS_UPDATED_NEED_REBOOT status is set, |
| - // restarted chrome would not get this status. See crbug.com/154104. |
| - GetUpdateEngineStatus(); |
| + update_engine_proxy_->WaitForServiceToBeAvailable( |
| + base::Bind(&UpdateEngineClientImpl::OnProxyAvailabilityChanged, |
| + weak_ptr_factory_.GetWeakPtr())); |
| } |
| private: |
| + void OnProxyAvailabilityChanged(bool service_is_available) { |
|
Daniel Erat
2016/08/11 01:13:50
i misunderstood how WaitForServiceToBeAvailable ac
|
| + if (service_is_available) { |
| + // Get update engine status for the initial status. Update engine won't |
| + // send StatusUpdate signal unless there is a status change. If chrome |
| + // crashes after UPDATE_STATUS_UPDATED_NEED_REBOOT status is set, |
| + // restarted chrome would not get this status. See crbug.com/154104. |
| + GetUpdateEngineStatus(); |
| + } |
| + } |
| + |
| void GetUpdateEngineStatus() { |
| dbus::MethodCall method_call( |
| update_engine::kUpdateEngineInterface, |