| Index: chromeos/dbus/upstart_client.cc
|
| diff --git a/chromeos/dbus/upstart_client.cc b/chromeos/dbus/upstart_client.cc
|
| index 7e08d265c8bab4695f075fdc91f2f8e0a82d5250..2f4d61555fff317b016b02bfa5ac9c734720dc86 100644
|
| --- a/chromeos/dbus/upstart_client.cc
|
| +++ b/chromeos/dbus/upstart_client.cc
|
| @@ -17,6 +17,7 @@ namespace {
|
| const char kUpstartServiceName[] = "com.ubuntu.Upstart";
|
| const char kUpstartJobInterface[] = "com.ubuntu.Upstart0_6.Job";
|
| const char kUpstartStartMethod[] = "Start";
|
| +const char kUpstartRestartMethod[] = "Restart";
|
|
|
| const char kUpstartAuthPolicyPath[] = "/com/ubuntu/Upstart/jobs/authpolicyd";
|
|
|
| @@ -28,27 +29,41 @@ class UpstartClientImpl : public UpstartClient {
|
|
|
| // UpstartClient override.
|
| void StartAuthPolicyService() override {
|
| - dbus::ObjectPath objectPath(kUpstartAuthPolicyPath);
|
| - dbus::ObjectProxy* proxy =
|
| - bus_->GetObjectProxy(kUpstartServiceName, objectPath);
|
| dbus::MethodCall method_call(kUpstartJobInterface, kUpstartStartMethod);
|
| dbus::MessageWriter writer(&method_call);
|
| writer.AppendArrayOfStrings(std::vector<std::string>());
|
| writer.AppendBool(true); // Wait for response.
|
| - proxy->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| - base::Bind(&UpstartClientImpl::HandleStartResponse,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| + auth_proxy_->CallMethod(&method_call,
|
| + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + base::Bind(&UpstartClientImpl::HandleAuthResponse,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| + }
|
| +
|
| + void RestartAuthPolicyService() override {
|
| + dbus::MethodCall method_call(kUpstartJobInterface, kUpstartRestartMethod);
|
| + dbus::MessageWriter writer(&method_call);
|
| + writer.AppendArrayOfStrings(std::vector<std::string>());
|
| + writer.AppendBool(true); // Wait for response.
|
| + auth_proxy_->CallMethod(&method_call,
|
| + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + base::Bind(&UpstartClientImpl::HandleAuthResponse,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| protected:
|
| - void Init(dbus::Bus* bus) override { bus_ = bus; }
|
| + void Init(dbus::Bus* bus) override {
|
| + bus_ = bus;
|
| + auth_proxy_ = bus_->GetObjectProxy(
|
| + kUpstartServiceName, dbus::ObjectPath(kUpstartAuthPolicyPath));
|
| + }
|
|
|
| private:
|
| - void HandleStartResponse(dbus::Response* response) {
|
| + void HandleAuthResponse(dbus::Response* response) {
|
| LOG_IF(ERROR, !response) << "Failed to signal Upstart, response is null";
|
| }
|
|
|
| dbus::Bus* bus_ = nullptr;
|
| + dbus::ObjectProxy* auth_proxy_ = nullptr;
|
|
|
| // Note: This should remain the last member so it'll be destroyed and
|
| // invalidate its weak pointers before any other members are destroyed.
|
|
|