Commit 74b6eaa1 authored by hidehiko's avatar hidehiko Committed by Commit bot

Remove explicit singletonness of ArcBridgeService part 5.

Remove ArcBridgeService::Get().
Now all usage was gone. It's time to delete the function.

BUG=657687
BUG=b/31079732
TEST=Ran bots.

Review-Url: https://codereview.chromium.org/2558313002
Cr-Commit-Position: refs/heads/master@{#437816}
parent fb92a942
...@@ -21,9 +21,6 @@ const base::Feature kArcEnabledFeature{"EnableARC", ...@@ -21,9 +21,6 @@ const base::Feature kArcEnabledFeature{"EnableARC",
} // namespace } // namespace
// Weak pointer. This class is owned by ArcServiceManager.
ArcBridgeService* g_arc_bridge_service = nullptr;
ArcBridgeService::ArcBridgeService() ArcBridgeService::ArcBridgeService()
: state_(State::STOPPED), : state_(State::STOPPED),
stop_reason_(StopReason::SHUTDOWN), stop_reason_(StopReason::SHUTDOWN),
...@@ -34,18 +31,6 @@ ArcBridgeService::~ArcBridgeService() { ...@@ -34,18 +31,6 @@ ArcBridgeService::~ArcBridgeService() {
DCHECK(state() == State::STOPPING || state() == State::STOPPED); DCHECK(state() == State::STOPPING || state() == State::STOPPED);
} }
// static
ArcBridgeService* ArcBridgeService::Get() {
if (!g_arc_bridge_service) {
// ArcBridgeService may be indirectly referenced in unit tests where
// ArcBridgeService is optional.
LOG(ERROR) << "ArcBridgeService is not ready.";
return nullptr;
}
DCHECK(g_arc_bridge_service->CalledOnValidThread());
return g_arc_bridge_service;
}
// static // static
bool ArcBridgeService::GetEnabled(const base::CommandLine* command_line) { bool ArcBridgeService::GetEnabled(const base::CommandLine* command_line) {
return command_line->HasSwitch(chromeos::switches::kEnableArc) || return command_line->HasSwitch(chromeos::switches::kEnableArc) ||
......
...@@ -90,10 +90,6 @@ class ArcBridgeService { ...@@ -90,10 +90,6 @@ class ArcBridgeService {
virtual ~ArcBridgeService(); virtual ~ArcBridgeService();
// Gets the global instance of the ARC Bridge Service. This can only be
// called on the thread that this class was created on.
static ArcBridgeService* Get();
// Return true if ARC has been enabled through a commandline // Return true if ARC has been enabled through a commandline
// switch. // switch.
static bool GetEnabled(const base::CommandLine* command_line); static bool GetEnabled(const base::CommandLine* command_line);
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
namespace arc { namespace arc {
extern ArcBridgeService* g_arc_bridge_service;
namespace { namespace {
constexpr int64_t kReconnectDelayInSeconds = 5; constexpr int64_t kReconnectDelayInSeconds = 5;
} // namespace } // namespace
...@@ -32,17 +29,11 @@ ArcBridgeServiceImpl::ArcBridgeServiceImpl( ...@@ -32,17 +29,11 @@ ArcBridgeServiceImpl::ArcBridgeServiceImpl(
const scoped_refptr<base::TaskRunner>& blocking_task_runner) const scoped_refptr<base::TaskRunner>& blocking_task_runner)
: session_started_(false), : session_started_(false),
factory_(base::Bind(ArcSession::Create, this, blocking_task_runner)), factory_(base::Bind(ArcSession::Create, this, blocking_task_runner)),
weak_factory_(this) { weak_factory_(this) {}
DCHECK(!g_arc_bridge_service);
g_arc_bridge_service = this;
}
ArcBridgeServiceImpl::~ArcBridgeServiceImpl() { ArcBridgeServiceImpl::~ArcBridgeServiceImpl() {
if (arc_session_) if (arc_session_)
arc_session_->RemoveObserver(this); arc_session_->RemoveObserver(this);
DCHECK(g_arc_bridge_service == this);
g_arc_bridge_service = nullptr;
} }
void ArcBridgeServiceImpl::RequestStart() { void ArcBridgeServiceImpl::RequestStart() {
......
...@@ -6,16 +6,9 @@ ...@@ -6,16 +6,9 @@
namespace arc { namespace arc {
extern ArcBridgeService* g_arc_bridge_service; FakeArcBridgeService::FakeArcBridgeService() = default;
FakeArcBridgeService::FakeArcBridgeService() {
DCHECK(!g_arc_bridge_service);
g_arc_bridge_service = this;
}
FakeArcBridgeService::~FakeArcBridgeService() { FakeArcBridgeService::~FakeArcBridgeService() {
DCHECK(g_arc_bridge_service == this);
g_arc_bridge_service = nullptr;
SetStopped(); SetStopped();
} }
......
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