Migrate chromeos::DBusThreadManager to namespace ash
This CL is part of the Chrome OS source code directory migration: https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE. Bug: 1164001 Change-Id: Ie61000b26076f921187bc8dcb99397f9899d903d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3836621 Reviewed-by: Hidehiko Abe <hidehiko@chromium.org> Commit-Queue: Yeunjoo Choi <ychoi@igalia.com> Owners-Override: Hidehiko Abe <hidehiko@chromium.org> Cr-Commit-Position: refs/heads/main@{#1037539}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
40706d35cb
commit
d1331bf08f
chrome/browser
ash
crostini
dbus
plugin_vm
policy
metrics
ui
chromeos/ash/components/dbus
content
extensions/shell/browser
rlz
services/device/media_transfer_protocol
@ -36,7 +36,7 @@ class AnsibleManagementTestHelper {
|
||||
Profile* profile_;
|
||||
base::test::ScopedFeatureList scoped_feature_list_;
|
||||
|
||||
// Owned by chromeos::DBusThreadManager
|
||||
// Owned by ash::DBusThreadManager
|
||||
ash::FakeCiceroneClient* fake_cicerone_client_;
|
||||
};
|
||||
|
||||
|
@ -125,10 +125,10 @@ void InitializeDBus() {
|
||||
chromeos::SystemSaltGetter::Initialize();
|
||||
|
||||
// Initialize DBusThreadManager for the browser.
|
||||
chromeos::DBusThreadManager::Initialize();
|
||||
DBusThreadManager::Initialize();
|
||||
|
||||
// Initialize Chrome dbus clients.
|
||||
dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus();
|
||||
dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus();
|
||||
|
||||
shill_clients::Initialize(bus);
|
||||
|
||||
@ -212,7 +212,7 @@ void InitializeDBus() {
|
||||
void InitializeFeatureListDependentDBus() {
|
||||
using chromeos::InitializeDBusClient;
|
||||
|
||||
dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus();
|
||||
dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus();
|
||||
if (floss::features::IsFlossEnabled()) {
|
||||
InitializeDBusClient<floss::FlossDBusManager>(bus);
|
||||
} else {
|
||||
@ -329,7 +329,7 @@ void ShutdownDBus() {
|
||||
AnomalyDetectorClient::Shutdown();
|
||||
|
||||
shill_clients::Shutdown();
|
||||
chromeos::DBusThreadManager::Shutdown();
|
||||
DBusThreadManager::Shutdown();
|
||||
chromeos::SystemSaltGetter::Shutdown();
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ class PluginVmInstallerTestBase : public testing::Test {
|
||||
// A pointer to a singleton object which is valid until
|
||||
// ConciergeClient::Shutdown() is called.
|
||||
ash::FakeConciergeClient* fake_concierge_client_;
|
||||
// Owned by chromeos::DBusThreadManager
|
||||
// Owned by ash::DBusThreadManager
|
||||
chromeos::FakeDlcserviceClient* fake_dlcservice_client_;
|
||||
|
||||
private:
|
||||
|
@ -137,7 +137,7 @@ BrowserPolicyConnectorAsh::BrowserPolicyConnectorAsh()
|
||||
|
||||
// DBusThreadManager or DeviceSettingsService may be
|
||||
// uninitialized on unit tests.
|
||||
if (chromeos::DBusThreadManager::IsInitialized() &&
|
||||
if (ash::DBusThreadManager::IsInitialized() &&
|
||||
ash::DeviceSettingsService::IsInitialized()) {
|
||||
std::unique_ptr<DeviceCloudPolicyStoreAsh> device_cloud_policy_store =
|
||||
std::make_unique<DeviceCloudPolicyStoreAsh>(
|
||||
|
@ -133,7 +133,7 @@ void ChromeFeatureListCreator::CreatePrefService() {
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// DBus must be initialized before constructing the policy connector.
|
||||
CHECK(chromeos::DBusThreadManager::IsInitialized());
|
||||
CHECK(ash::DBusThreadManager::IsInitialized());
|
||||
browser_policy_connector_ =
|
||||
std::make_unique<policy::BrowserPolicyConnectorAsh>();
|
||||
#else
|
||||
|
@ -140,7 +140,7 @@ class ProfileProviderRealCollectionTest : public testing::Test {
|
||||
const ProfileProviderRealCollectionTest&) = delete;
|
||||
|
||||
void SetUp() override {
|
||||
chromeos::DBusThreadManager::Initialize();
|
||||
ash::DBusThreadManager::Initialize();
|
||||
// ProfileProvider requires chromeos::LoginState and
|
||||
// chromeos::PowerManagerClient to be initialized.
|
||||
chromeos::PowerManagerClient::InitializeFake();
|
||||
@ -186,7 +186,7 @@ class ProfileProviderRealCollectionTest : public testing::Test {
|
||||
TestingBrowserProcess::DeleteInstance();
|
||||
chromeos::LoginState::Shutdown();
|
||||
chromeos::PowerManagerClient::Shutdown();
|
||||
chromeos::DBusThreadManager::Shutdown();
|
||||
ash::DBusThreadManager::Shutdown();
|
||||
variations::testing::ClearAllVariationParams();
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ void CreateShell() {
|
||||
shell_init_params.local_state = g_browser_process->local_state();
|
||||
shell_init_params.keyboard_ui_factory =
|
||||
std::make_unique<ChromeKeyboardUIFactory>();
|
||||
shell_init_params.dbus_bus =
|
||||
chromeos::DBusThreadManager::Get()->GetSystemBus();
|
||||
shell_init_params.dbus_bus = ash::DBusThreadManager::Get()->GetSystemBus();
|
||||
|
||||
ash::Shell::CreateInstance(std::move(shell_init_params));
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace ash {
|
||||
|
||||
static DBusThreadManager* g_dbus_thread_manager = nullptr;
|
||||
|
||||
@ -23,9 +23,9 @@ void DBusThreadManager::Initialize() {
|
||||
g_dbus_thread_manager = new DBusThreadManager();
|
||||
|
||||
if (!g_dbus_thread_manager->IsUsingFakes())
|
||||
VLOG(1) << "DBusThreadManager initialized for ChromeOS";
|
||||
VLOG(1) << "ash::DBusThreadManager initialized for ChromeOS";
|
||||
else
|
||||
VLOG(1) << "DBusThreadManager created for testing";
|
||||
VLOG(1) << "ash::DBusThreadManager created for testing";
|
||||
}
|
||||
|
||||
// static
|
||||
@ -52,4 +52,4 @@ DBusThreadManager* DBusThreadManager::Get() {
|
||||
return g_dbus_thread_manager;
|
||||
}
|
||||
|
||||
} // namespace chromeos
|
||||
} // namespace ash
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include "base/component_export.h"
|
||||
#include "chromeos/dbus/init/dbus_thread_manager_base.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace ash {
|
||||
|
||||
// Ash implementation of DBusThreadManagerBase.
|
||||
class COMPONENT_EXPORT(ASH_DBUS) DBusThreadManager
|
||||
: public DBusThreadManagerBase {
|
||||
: public chromeos::DBusThreadManagerBase {
|
||||
public:
|
||||
// Sets the global instance. Must be called before any calls to Get().
|
||||
// We explicitly initialize and shut down the global object, rather than
|
||||
@ -36,11 +36,6 @@ class COMPONENT_EXPORT(ASH_DBUS) DBusThreadManager
|
||||
~DBusThreadManager() override;
|
||||
};
|
||||
|
||||
} // namespace chromeos
|
||||
|
||||
// TODO(https://crbug.com/1164001): remove after moved to ash.
|
||||
namespace ash {
|
||||
using ::chromeos::DBusThreadManager;
|
||||
}
|
||||
} // namespace ash
|
||||
|
||||
#endif // CHROMEOS_ASH_COMPONENTS_DBUS_DBUS_THREAD_MANAGER_H_
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace ash {
|
||||
|
||||
TEST(DBusThreadManagerTest, Initialize) {
|
||||
DBusThreadManager::Initialize();
|
||||
@ -22,4 +22,4 @@ TEST(DBusThreadManagerTest, Initialize) {
|
||||
EXPECT_FALSE(DBusThreadManager::IsInitialized());
|
||||
}
|
||||
|
||||
} // namespace chromeos
|
||||
} // namespace ash
|
||||
|
@ -38,7 +38,7 @@ class CrOSSystemTracingSession {
|
||||
// |true| if tracing was started and |false| otherwise.
|
||||
void StartTracing(const std::string& config, SuccessCallback callback) {
|
||||
DCHECK(!is_tracing_);
|
||||
if (!chromeos::DBusThreadManager::IsInitialized()) {
|
||||
if (!ash::DBusThreadManager::IsInitialized()) {
|
||||
if (callback)
|
||||
std::move(callback).Run(/*success=*/false);
|
||||
return;
|
||||
|
@ -116,7 +116,7 @@ ShellBrowserMainParts::~ShellBrowserMainParts() = default;
|
||||
|
||||
void ShellBrowserMainParts::PostCreateMainMessageLoop() {
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
chromeos::DBusThreadManager::Initialize();
|
||||
ash::DBusThreadManager::Initialize();
|
||||
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
chromeos::LacrosDBusThreadManager::Initialize();
|
||||
#endif
|
||||
@ -212,7 +212,7 @@ void ShellBrowserMainParts::PostDestroyThreads() {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
chromeos::DBusThreadManager::Shutdown();
|
||||
ash::DBusThreadManager::Shutdown();
|
||||
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
chromeos::LacrosDBusThreadManager::Shutdown();
|
||||
#endif
|
||||
|
@ -108,8 +108,8 @@ void ShellBrowserMainParts::PostCreateMainMessageLoop() {
|
||||
// Perform initialization of D-Bus objects here rather than in the below
|
||||
// helper classes so those classes' tests can initialize stub versions of the
|
||||
// D-Bus objects.
|
||||
chromeos::DBusThreadManager::Initialize();
|
||||
dbus::Bus* bus = chromeos::DBusThreadManager::Get()->GetSystemBus();
|
||||
ash::DBusThreadManager::Initialize();
|
||||
dbus::Bus* bus = ash::DBusThreadManager::Get()->GetSystemBus();
|
||||
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
chromeos::LacrosDBusThreadManager::Initialize();
|
||||
dbus::Bus* bus = chromeos::LacrosDBusThreadManager::Get()->GetSystemBus();
|
||||
@ -315,7 +315,7 @@ void ShellBrowserMainParts::PostDestroyThreads() {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
chromeos::DBusThreadManager::Shutdown();
|
||||
ash::DBusThreadManager::Shutdown();
|
||||
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
chromeos::LacrosDBusThreadManager::Shutdown();
|
||||
#endif
|
||||
|
@ -18,7 +18,7 @@ namespace extensions {
|
||||
// Handles network-related tasks for app_shell on Chrome OS.
|
||||
class ShellNetworkController : public ash::NetworkStateHandlerObserver {
|
||||
public:
|
||||
// This class must be instantiated after chromeos::DBusThreadManager and
|
||||
// This class must be instantiated after ash::DBusThreadManager and
|
||||
// destroyed before it.
|
||||
explicit ShellNetworkController(const std::string& preferred_network_name);
|
||||
|
||||
|
@ -126,10 +126,8 @@ void OnSetRlzPingSent(int retry_count, bool success);
|
||||
void SetRlzPingSent(int retry_count) {
|
||||
// GetSystemBus() could return null in tests.
|
||||
base::SequencedTaskRunner* const origin_task_runner =
|
||||
chromeos::DBusThreadManager::Get()->GetSystemBus()
|
||||
? chromeos::DBusThreadManager::Get()
|
||||
->GetSystemBus()
|
||||
->GetOriginTaskRunner()
|
||||
ash::DBusThreadManager::Get()->GetSystemBus()
|
||||
? ash::DBusThreadManager::Get()->GetSystemBus()->GetOriginTaskRunner()
|
||||
: nullptr;
|
||||
if (origin_task_runner && !origin_task_runner->RunsTasksInCurrentSequence()) {
|
||||
origin_task_runner->PostTask(FROM_HERE,
|
||||
|
@ -1112,7 +1112,7 @@ class ScopedTestDebugDaemonClient : public ash::FakeDebugDaemonClient {
|
||||
};
|
||||
|
||||
TEST_F(RlzLibTest, SetRlzPingSent) {
|
||||
chromeos::DBusThreadManager::Initialize();
|
||||
ash::DBusThreadManager::Initialize();
|
||||
auto debug_daemon_client = std::make_unique<ScopedTestDebugDaemonClient>();
|
||||
const char* kPingResponse =
|
||||
"stateful-events: CAF\r\n"
|
||||
@ -1133,7 +1133,7 @@ TEST_F(RlzLibTest, SetRlzPingSent) {
|
||||
EXPECT_EQ(debug_daemon_client->num_set_rlz_ping_sent(),
|
||||
1 + rlz_lib::RlzValueStoreChromeOS::kMaxRetryCount);
|
||||
debug_daemon_client.reset();
|
||||
chromeos::DBusThreadManager::Shutdown();
|
||||
ash::DBusThreadManager::Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(RlzLibTest, NoRecordCAFEvent) {
|
||||
|
@ -22,7 +22,7 @@ MtpDeviceManager* g_mtp_device_manager = nullptr;
|
||||
} // namespace
|
||||
|
||||
MtpDeviceManager::MtpDeviceManager()
|
||||
: bus_(chromeos::DBusThreadManager::Get()->GetSystemBus()) {
|
||||
: bus_(ash::DBusThreadManager::Get()->GetSystemBus()) {
|
||||
// Listen for future mtpd service owner changes, in case it is not
|
||||
// available right now. There is no guarantee that mtpd is running already.
|
||||
dbus::Bus::ServiceOwnerChangeCallback mtpd_owner_changed_callback =
|
||||
|
Reference in New Issue
Block a user