Commit f1743f83 authored by Patrick Monette's avatar Patrick Monette Committed by Commit Bot

Reverse the effect of the background inspection feature

While it makes the code a bit less readable, writing the server-side
configuration file will be way easier.

Bug: 928846
Change-Id: I1e2965d335443fed643fe779adf3fcb6fd81d030
Reviewed-on: https://chromium-review.googlesource.com/c/1495860Reviewed-by: default avatarEtienne Bergeron <etienneb@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636855}
parent d0dc6983
......@@ -75,7 +75,7 @@ void WriteInspectionResultCacheOnBackgroundSequence(
} // namespace
// static
constexpr base::Feature ModuleInspector::kEnableBackgroundModuleInspection;
constexpr base::Feature ModuleInspector::kDisableBackgroundModuleInspection;
// static
constexpr base::Feature ModuleInspector::kWinOOPInspectModuleFeature;
......@@ -93,8 +93,8 @@ ModuleInspector::ModuleInspector(
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})),
inspection_results_cache_read_(false),
connection_error_retry_count_(kConnectionErrorRetryCount),
background_inspection_enabled_(
base::FeatureList::IsEnabled(kEnableBackgroundModuleInspection)),
background_inspection_disabled_(
base::FeatureList::IsEnabled(kDisableBackgroundModuleInspection)),
test_connector_(nullptr),
weak_ptr_factory_(this) {
// Use AfterStartupTaskUtils to be notified when startup is finished.
......@@ -131,10 +131,10 @@ void ModuleInspector::IncreaseInspectionPriority() {
OnStartupFinished();
// Special case where this instance could be ready to start inspecting but
// wasn't because the background inspection feature was disabled.
if (!background_inspection_enabled_ && inspection_results_cache_read_ &&
// wasn't because background inspection was disabled.
if (background_inspection_disabled_ && inspection_results_cache_read_ &&
!queue_.empty()) {
background_inspection_enabled_ = true;
background_inspection_disabled_ = false;
StartInspectingModule();
}
}
......@@ -225,7 +225,7 @@ void ModuleInspector::StartInspectingModule() {
DCHECK(inspection_results_cache_read_);
DCHECK(!queue_.empty());
if (!background_inspection_enabled_)
if (background_inspection_disabled_)
return;
const ModuleInfoKey& module_key = queue_.front();
......
......@@ -44,8 +44,8 @@ class ModuleInspector : public ModuleDatabaseObserver {
// background sequence. It will be used to assess the impact of this work on
// Chrome's overall performance.
// TODO(pmonette): Remove when no longer needed. See https://crbug.com/928846.
static constexpr base::Feature kEnableBackgroundModuleInspection = {
"EnableBackgroundModuleInspection", base::FEATURE_ENABLED_BY_DEFAULT};
static constexpr base::Feature kDisableBackgroundModuleInspection = {
"DisableBackgroundModuleInspection", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether or not module inspection is done out of process.
static constexpr base::Feature kWinOOPInspectModuleFeature = {
......@@ -146,10 +146,10 @@ class ModuleInspector : public ModuleDatabaseObserver {
// service always fails to start and the restart cycle happens infinitely.
int connection_error_retry_count_;
// Indicates if background inspection is enabled. Generally equal to the
// kBackgroundModuleInspection feature state, but will be set unconditionally
// to true if IncreaseInspectionPriority() is called.
bool background_inspection_enabled_;
// Indicates if background inspection is disabled. Generally equal to the
// kDisableBackgroundModuleInspection feature state, but will be set
// unconditionally to false if IncreaseInspectionPriority() is called.
bool background_inspection_disabled_;
// Used to connect to the UtilWin service during tests.
service_manager::Connector* test_connector_;
......
......@@ -94,8 +94,8 @@ TEST_F(ModuleInspectorTest, MultipleModules) {
TEST_F(ModuleInspectorTest, DisableBackgroundInspection) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
ModuleInspector::kEnableBackgroundModuleInspection);
scoped_feature_list.InitAndEnableFeature(
ModuleInspector::kDisableBackgroundModuleInspection);
ModuleInfoKey kTestCases[] = {
{base::FilePath(), 0, 0},
......
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