chromium/third_party/blink/renderer/platform/scheduler/main_thread/memory_purge_manager.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/platform/scheduler/main_thread/memory_purge_manager.h"

#include "base/feature_list.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/metrics/field_trial_params.h"
#include "base/rand_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/platform.h"

namespace blink {

namespace {

BASE_FEATURE();

// The time of first purging after a renderer is backgrounded. The value was
// initially set to 30 minutes, but it was reduced to 1 minute because this
// reduced the memory usage of a renderer 15 minutes after it was backgrounded.
//
// Experiment results:
// https://docs.google.com/document/d/1E88EYNlZE1DhmlgmjUnGnCAASm8-tWCAWXy8p53vmwc/edit?usp=sharing
const base::FeatureParam<base::TimeDelta> kMemoryPurgeInBackgroundMinDelay{};
const base::FeatureParam<base::TimeDelta> kMemoryPurgeInBackgroundMaxDelay{};

}  // namespace

MemoryPurgeManager::MemoryPurgeManager(
    scoped_refptr<base::SingleThreadTaskRunner> task_runner) {}

MemoryPurgeManager::~MemoryPurgeManager() = default;

void MemoryPurgeManager::OnPageCreated() {}

void MemoryPurgeManager::OnPageDestroyed(bool frozen) {}

void MemoryPurgeManager::OnPageFrozen(
    base::MemoryReductionTaskContext called_from) {}

void MemoryPurgeManager::OnPageResumed() {}

void MemoryPurgeManager::SetRendererBackgrounded(bool backgrounded) {}

void MemoryPurgeManager::OnRendererBackgrounded() {}

void MemoryPurgeManager::OnRendererForegrounded() {}

void MemoryPurgeManager::RequestMemoryPurgeWithDelay(base::TimeDelta delay) {}

void MemoryPurgeManager::PerformMemoryPurge() {}

bool MemoryPurgeManager::CanPurge() const {}

bool MemoryPurgeManager::AreAllPagesFrozen() const {}

base::TimeDelta MemoryPurgeManager::GetTimeToPurgeAfterBackgrounded() const {}

}  // namespace blink