Commit 60bd4b09 authored by Shubhie Panicker's avatar Shubhie Panicker Committed by Commit Bot

Enable StopNonTimersInBackground by default on Android.

Bug: 822954
Change-Id: Ife5a6460c0215fa188e3734fa781ecfb994e94b9
Reviewed-on: https://chromium-review.googlesource.com/1241994
Commit-Queue: Shubhie Panicker <panicker@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594148}
parent f0a8f786
......@@ -67,10 +67,16 @@ const base::Feature kStopInBackground {
#endif
};
// Freeze non-timer task queues in background, after allowed grace time. Launch
// bug: https://crbug.com/822954. "stop" is a legacy name.
const base::Feature kStopNonTimersInBackground{
"stop-non-timers-in-background", base::FEATURE_DISABLED_BY_DEFAULT};
// Freeze non-timer task queues in background, after allowed grace time.
// "stop" is a legacy name.
const base::Feature kStopNonTimersInBackground {
"stop-non-timers-in-background",
#if defined(OS_ANDROID)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
// Writable files and native filesystem access. https://crbug.com/853326
const base::Feature kWritableFilesAPI{"WritableFilesAPI",
......
......@@ -160,6 +160,14 @@ class FrameSchedulerImplStopNonTimersInBackgroundEnabledTest
{}) {}
};
class FrameSchedulerImplStopNonTimersInBackgroundDisabledTest
: public FrameSchedulerImplTest {
public:
FrameSchedulerImplStopNonTimersInBackgroundDisabledTest()
: FrameSchedulerImplTest({},
{blink::features::kStopNonTimersInBackground}) {}
};
namespace {
class MockLifecycleObserver final : public FrameScheduler::Observer {
......@@ -391,7 +399,8 @@ TEST_F(FrameSchedulerImplStopNonTimersInBackgroundEnabledTest,
EXPECT_EQ(5, counter);
}
TEST_F(FrameSchedulerImplTest, PageFreezeAndUnfreezeFlagDisabled) {
TEST_F(FrameSchedulerImplStopNonTimersInBackgroundDisabledTest,
PageFreezeAndUnfreezeFlagDisabled) {
int counter = 0;
LoadingTaskQueue()->task_runner()->PostTask(
FROM_HERE, base::BindOnce(&IncrementCounter, base::Unretained(&counter)));
......@@ -1612,6 +1621,8 @@ class ThrottleableAndFreezableTaskTypesTest
};
TEST_F(ThrottleableAndFreezableTaskTypesTest, QueueTraitsFromFieldTrialParams) {
if (base::FeatureList::IsEnabled(blink::features::kStopNonTimersInBackground))
return;
// These tests will start to fail if the default task queues or queue traits
// change for these task types.
......@@ -1627,7 +1638,6 @@ TEST_F(ThrottleableAndFreezableTaskTypesTest, QueueTraitsFromFieldTrialParams) {
task_queue->GetQueueTraits(),
MainThreadTaskQueue::QueueTraits().SetCanBeFrozen(true).SetCanBePaused(
true));
task_queue = GetTaskQueue(TaskType::kDatabaseAccess);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeThrottled(true)
......@@ -1669,6 +1679,9 @@ class FreezableOnlyTaskTypesTest
};
TEST_F(FreezableOnlyTaskTypesTest, QueueTraitsFromFieldTrialParams) {
if (base::FeatureList::IsEnabled(blink::features::kStopNonTimersInBackground))
return;
// These tests will start to fail if the default task queues or queue traits
// change for these task types.
......@@ -1726,6 +1739,9 @@ class ThrottleableOnlyTaskTypesTest
};
TEST_F(ThrottleableOnlyTaskTypesTest, QueueTraitsFromFieldTrialParams) {
if (base::FeatureList::IsEnabled(blink::features::kStopNonTimersInBackground))
return;
// These tests will start to fail if the default task queues or queue traits
// change for these task types.
......
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