Commit cddd568a authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Disable SingleProcessMash when multi-process Mash is enabled

The two feature flags are incompatible, so make multi-process mash
take precedence.

Fix some direct references to features::kMash for consistency.

TBR=sky@chromium.org

Bug: 918859
Test: chrome --login-manager --enable-features=Mash logs in
Change-Id: I18ac68e5e7bd01962369549b2b966592b9db0105
Reviewed-on: https://chromium-review.googlesource.com/c/1394796
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619786}
parent 667813f4
......@@ -69,7 +69,7 @@ AshService::AshService(service_manager::mojom::ServiceRequest request)
: service_binding_(this, std::move(request)) {}
AshService::~AshService() {
if (!base::FeatureList::IsEnabled(features::kMash))
if (!::features::IsMultiProcessMash())
return;
// Shutdown part of GpuHost before deleting Shell. This is necessary to
......@@ -175,7 +175,7 @@ void AshService::OnStart() {
registry_.AddInterface(base::BindRepeating(&AshService::BindServiceFactory,
base::Unretained(this)));
if (base::FeatureList::IsEnabled(features::kMash))
if (::features::IsMultiProcessMash())
InitForMash();
}
......@@ -192,7 +192,7 @@ void AshService::CreateService(
service_manager::mojom::PIDReceiverPtr pid_receiver) {
DCHECK_EQ(name, ws::mojom::kServiceName);
Shell::Get()->window_service_owner()->BindWindowService(std::move(service));
if (base::FeatureList::IsEnabled(features::kMash)) {
if (::features::IsMultiProcessMash()) {
ws::WindowService* window_service =
Shell::Get()->window_service_owner()->window_service();
input_device_controller_ = std::make_unique<ws::InputDeviceController>();
......
......@@ -187,7 +187,7 @@ void AshWindowTreeHostPlatform::CommonInit() {
event_queue_ =
Shell::Get()->window_service_owner()->window_service()->event_queue();
if (!base::FeatureList::IsEnabled(features::kMash))
if (!::features::IsMultiProcessMash())
return;
input_method_ = std::make_unique<aura::InputMethodMus>(this, this);
......
......@@ -4,38 +4,30 @@
#include "ash/system/flag_warning/flag_warning_tray.h"
#include "ash/root_window_controller.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
#include "ash/test/ash_test_base.h"
#include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "ui/base/ui_base_features.h"
namespace ash {
namespace {
class FlagWarningTrayTest : public AshTestBase {
public:
FlagWarningTrayTest() = default;
~FlagWarningTrayTest() override = default;
// testing::Test:
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(::features::kMash);
AshTestBase::SetUp();
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(FlagWarningTrayTest);
};
using FlagWarningTrayTest = AshTestBase;
TEST_F(FlagWarningTrayTest, VisibleForMash) {
FlagWarningTray* tray = Shell::GetPrimaryRootWindowController()
->GetStatusAreaWidget()
->flag_warning_tray_for_testing();
// Simulate enabling Mash.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{::features::kMash} /* enabled */,
{::features::kSingleProcessMash} /* disabled */);
StatusAreaWidget widget(Shell::GetContainer(Shell::GetPrimaryRootWindow(),
kShellWindowId_StatusContainer),
GetPrimaryShelf());
widget.Initialize();
FlagWarningTray* tray = widget.flag_warning_tray_for_testing();
ASSERT_TRUE(tray);
EXPECT_TRUE(tray->visible());
}
......
......@@ -152,6 +152,9 @@ ChromeBrowserMainExtraPartsAsh::~ChromeBrowserMainExtraPartsAsh() {
void ChromeBrowserMainExtraPartsAsh::ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) {
if (features::IsMultiProcessMash()) {
// Mash and SingleProcessMash cannot be enabled simultaneously.
DCHECK(!features::IsSingleProcessMash());
// ash::Shell will not be created because ash is running out-of-process.
ash::Shell::SetIsBrowserProcessWithMash();
}
......
......@@ -149,7 +149,8 @@ bool IsMashOopVizEnabled() {
}
bool IsSingleProcessMash() {
return base::FeatureList::IsEnabled(features::kSingleProcessMash);
return base::FeatureList::IsEnabled(features::kSingleProcessMash) &&
!base::FeatureList::IsEnabled(features::kMash);
}
bool IsAutomaticUiAdjustmentsForTouchEnabled() {
......
......@@ -60,6 +60,8 @@ UI_BASE_EXPORT extern const base::Feature kMash;
// make it the default kMash behavior.
UI_BASE_EXPORT extern const base::Feature kMashOopViz;
// NOTE: Do not access directly outside of tests. Use IsSingleProcessMash()
// to avoid problems when Mash and SingleProcessMash are both enabled.
UI_BASE_EXPORT extern const base::Feature kSingleProcessMash;
// Returns true if Chrome's aura usage is backed by the WindowService.
......
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