Commit 954b3b57 authored by Benoit Lize's avatar Benoit Lize Committed by Commit Bot

[blink/bindings] Remove dead code in ParkableStringManager.

Whether the renderer is backgrounded is not used anymore, no need to
track it.

Change-Id: I4547feceb362d5fba90fbabf0b3842862a2d6af1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2552404Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829658}
parent a5d29c16
......@@ -127,16 +127,6 @@ ParkableStringManager& ParkableStringManager::Instance() {
ParkableStringManager::~ParkableStringManager() = default;
void ParkableStringManager::SetRendererBackgrounded(bool backgrounded) {
DCHECK(IsMainThread());
backgrounded_ = backgrounded;
}
bool ParkableStringManager::IsRendererBackgrounded() const {
DCHECK(IsMainThread());
return backgrounded_;
}
bool ParkableStringManager::OnMemoryDump(
base::trace_event::ProcessMemoryDump* pmd) {
DCHECK(IsMainThread());
......@@ -486,7 +476,6 @@ ParkableStringManager::Statistics ParkableStringManager::ComputeStatistics()
}
void ParkableStringManager::ResetForTesting() {
backgrounded_ = false;
has_pending_aging_task_ = false;
has_posted_unparking_time_accounting_task_ = false;
did_register_memory_pressure_listener_ = false;
......@@ -501,8 +490,7 @@ void ParkableStringManager::ResetForTesting() {
}
ParkableStringManager::ParkableStringManager()
: backgrounded_(false),
has_pending_aging_task_(false),
: has_pending_aging_task_(false),
has_posted_unparking_time_accounting_task_(false),
did_register_memory_pressure_listener_(false),
allocator_for_testing_(nullptr) {}
......
......@@ -56,8 +56,6 @@ class PLATFORM_EXPORT ParkableStringManager {
static ParkableStringManager& Instance();
~ParkableStringManager();
void SetRendererBackgrounded(bool backgrounded);
bool IsRendererBackgrounded() const;
void PurgeMemory();
// Number of parked and unparked strings. Public for testing.
size_t Size() const;
......@@ -125,7 +123,6 @@ class PLATFORM_EXPORT ParkableStringManager {
void ResetForTesting();
ParkableStringManager();
bool backgrounded_;
bool has_pending_aging_task_;
bool has_posted_unparking_time_accounting_task_;
bool did_register_memory_pressure_listener_;
......
......@@ -699,24 +699,7 @@ TEST_F(ParkableStringTest, SynchronousToDisk) {
EXPECT_TRUE(impl->is_on_disk()); // Synchronous writing.
}
TEST_F(ParkableStringTest, OnPurgeMemoryInBackground) {
ParkableString parkable = CreateAndParkAll();
ParkableStringManager::Instance().SetRendererBackgrounded(true);
EXPECT_TRUE(ParkableStringManager::Instance().IsRendererBackgrounded());
parkable.ToString();
EXPECT_FALSE(parkable.Impl()->is_parked());
EXPECT_TRUE(parkable.Impl()->has_compressed_data());
MemoryPressureListenerRegistry::Instance().OnPurgeMemory();
EXPECT_TRUE(parkable.Impl()->is_parked());
parkable.ToString();
EXPECT_TRUE(parkable.Impl()->has_compressed_data());
}
TEST_F(ParkableStringTest, OnPurgeMemoryInForeground) {
ParkableStringManager::Instance().SetRendererBackgrounded(false);
TEST_F(ParkableStringTest, OnPurgeMemory) {
ParkableString parkable1 = CreateAndParkAll();
ParkableString parkable2(MakeLargeString('b').ReleaseImpl());
......
......@@ -33,7 +33,6 @@
#include "third_party/blink/public/common/page/launching_process_state.h"
#include "third_party/blink/public/platform/scheduler/web_agent_group_scheduler.h"
#include "third_party/blink/public/platform/scheduler/web_renderer_process_type.h"
#include "third_party/blink/renderer/platform/bindings/parkable_string_manager.h"
#include "third_party/blink/renderer/platform/instrumentation/resource_coordinator/renderer_resource_coordinator.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/common/features.h"
......@@ -1083,7 +1082,6 @@ void MainThreadSchedulerImpl::SetRendererBackgrounded(bool backgrounded) {
main_thread_only().metrics_helper.OnRendererForegrounded(now);
}
ParkableStringManager::Instance().SetRendererBackgrounded(backgrounded);
memory_purge_manager_.SetRendererBackgrounded(backgrounded);
}
......
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