Commit 54b36841 authored by mhasank's avatar mhasank Committed by Commit Bot

Revert "arc: support receiving notification of arc stopped from upstart job"

This reverts commit b57c4658.

Reason for revert: The work has been abandoned and the change is not needed anymore.

TEST=deploy to dut, disable playstore, re-enable playstore, successfully finish the authorization flow

Bug: b:133248517
Change-Id: I46df509f1f364924a2a1da5bd9fe6fc4f3b85848
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2386101Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarRyo Hashimoto <hashimoto@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Muhammad Hasan Khan <mhasank@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803504}
parent de3e7829
......@@ -29,9 +29,6 @@ FakeUpstartClient::~FakeUpstartClient() {
g_instance = nullptr;
}
void FakeUpstartClient::AddObserver(Observer* observer) {}
void FakeUpstartClient::RemoveObserver(Observer* observer) {}
// static
FakeUpstartClient* FakeUpstartClient::Get() {
return g_instance;
......
......@@ -22,10 +22,6 @@ class COMPONENT_EXPORT(UPSTART_CLIENT) FakeUpstartClient
FakeUpstartClient();
~FakeUpstartClient() override;
// Adds or removes an observer.
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
// Returns the fake global instance if initialized. May return null.
static FakeUpstartClient* Get();
......
......@@ -14,7 +14,6 @@
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
......@@ -39,27 +38,10 @@ UpstartClient* g_instance = nullptr;
class UpstartClientImpl : public UpstartClient {
public:
explicit UpstartClientImpl(dbus::Bus* bus) : bus_(bus) {
dbus::ObjectProxy* arc_proxy = bus_->GetObjectProxy(
arc::kArcServiceName, dbus::ObjectPath(arc::kArcServicePath));
arc_proxy->ConnectToSignal(
arc::kArcInterfaceName, arc::kArcStopped,
base::BindRepeating(&UpstartClientImpl::ArcStoppedReceived,
weak_ptr_factory_.GetWeakPtr()),
base::BindOnce(&UpstartClientImpl::SignalConnected,
weak_ptr_factory_.GetWeakPtr()));
}
explicit UpstartClientImpl(dbus::Bus* bus) : bus_(bus) {}
~UpstartClientImpl() override = default;
void AddObserver(Observer* observer) override {
observers_.AddObserver(observer);
}
void RemoveObserver(Observer* observer) override {
observers_.RemoveObserver(observer);
}
// UpstartClient overrides:
void StartJob(const std::string& job,
const std::vector<std::string>& upstart_env,
......@@ -133,26 +115,12 @@ class UpstartClientImpl : public UpstartClient {
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
// Called when the object is connected to the signal.
void SignalConnected(const std::string& interface_name,
const std::string& signal_name,
bool success) {
LOG_IF(ERROR, !success) << "Failed to connect to " << signal_name;
}
void ArcStoppedReceived(dbus::Signal* signal) {
for (auto& observer : observers_)
observer.ArcStopped();
}
void OnVoidMethod(VoidDBusMethodCallback callback, dbus::Response* response) {
std::move(callback).Run(response);
}
dbus::Bus* bus_ = nullptr;
base::ObserverList<Observer> observers_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<UpstartClientImpl> weak_ptr_factory_{this};
......
......@@ -11,7 +11,6 @@
#include "base/callback.h"
#include "base/component_export.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "chromeos/dbus/dbus_method_call_status.h"
namespace dbus {
......@@ -25,13 +24,6 @@ namespace chromeos {
// initializes the DBusThreadManager instance.
class COMPONENT_EXPORT(UPSTART_CLIENT) UpstartClient {
public:
class Observer : public base::CheckedObserver {
public:
~Observer() override {}
// Called when the ARC is stopped after it had already started.
virtual void ArcStopped() {}
};
virtual ~UpstartClient();
// Creates and initializes the global instance. |bus| must not be null.
......@@ -46,10 +38,6 @@ class COMPONENT_EXPORT(UPSTART_CLIENT) UpstartClient {
// Returns the global instance if initialized. May return null.
static UpstartClient* Get();
// Adds or removes an observer.
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
// Starts an Upstart job.
// |job|: Name of Upstart job.
// |upstart_env|: List of upstart environment variables to be passed to the
......
......@@ -14,7 +14,6 @@
#include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/login_manager/arc.pb.h"
#include "chromeos/dbus/session_manager/session_manager_client.h"
#include "chromeos/dbus/upstart/upstart_client.h"
#include "components/arc/session/arc_session.h"
namespace arc {
......@@ -71,21 +70,16 @@ ToLoginManagerPlayStoreAutoUpdate(StartParams::PlayStoreAutoUpdate update) {
class ArcContainerClientAdapter
: public ArcClientAdapter,
public chromeos::SessionManagerClient::Observer,
public chromeos::UpstartClient::Observer {
public chromeos::SessionManagerClient::Observer {
public:
ArcContainerClientAdapter() {
if (chromeos::SessionManagerClient::Get())
chromeos::SessionManagerClient::Get()->AddObserver(this);
if (chromeos::UpstartClient::Get())
chromeos::UpstartClient::Get()->AddObserver(this);
}
~ArcContainerClientAdapter() override {
if (chromeos::SessionManagerClient::Get())
chromeos::SessionManagerClient::Get()->RemoveObserver(this);
if (chromeos::UpstartClient::Get())
chromeos::UpstartClient::Get()->RemoveObserver(this);
}
// ArcClientAdapter overrides:
......@@ -151,12 +145,6 @@ class ArcContainerClientAdapter
observer.ArcInstanceStopped();
}
// chromeos::UpstartClient::Observer overrides:
void ArcStopped() override {
for (auto& observer : observer_list_)
observer.ArcInstanceStopped();
}
private:
// A cryptohome ID of the primary profile.
cryptohome::Identification cryptohome_id_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment