mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 22:36:09 +03:00
57 lines
2.5 KiB
Plaintext
57 lines
2.5 KiB
Plaintext
|
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style license that can be
|
||
|
// found in the LICENSE file.
|
||
|
|
||
|
module blink.mojom;
|
||
|
|
||
|
import "mojo/public/mojom/base/shared_memory.mojom";
|
||
|
|
||
|
// There are two phases to estimate a near-OOM situation. First phase takes
|
||
|
// place in the browser process. When the browser detects a high memory
|
||
|
// pressure it starts the second phase in the foreground renderer process,
|
||
|
// as the renderer has the best knowledge about memory usage of pages.
|
||
|
// The renderer schedules tasks to check memory workload from pages. If the
|
||
|
// workload exceeds a threshold the renderer notifies that a high memory usage
|
||
|
// is detected.
|
||
|
|
||
|
// Browser side interface for OOM intervention. This interface is used to check
|
||
|
// high memory usage in a renderer.
|
||
|
interface OomInterventionHost {
|
||
|
// Called when a renderer detects high memory usage. |intervention_triggered|
|
||
|
// is set to true when the OOM intervention is activated in the renderer.
|
||
|
OnHighMemoryUsage(bool intervention_triggered);
|
||
|
};
|
||
|
|
||
|
// Arguments set by field trials to configure various thresholds for detecting
|
||
|
// OOM. Setting a threshold to 0 means that OOM detection will not consider
|
||
|
// that threshold.
|
||
|
struct DetectionArgs {
|
||
|
// Limit on V8 + BlinkGC + PartitionAlloc.
|
||
|
uint64 blink_workload_threshold;
|
||
|
|
||
|
// Limit on total private footprint of the process.
|
||
|
uint64 private_footprint_threshold;
|
||
|
|
||
|
// Limit on total swap footprint of the process.
|
||
|
uint64 swap_threshold;
|
||
|
|
||
|
// Limit on total virtual memory used by the process.
|
||
|
uint64 virtual_memory_thresold;
|
||
|
};
|
||
|
|
||
|
// Renderer side interface for OOM intervention. An instance of this interface
|
||
|
// will be created when the browser gets a high memory pressure signal.
|
||
|
// It monitors memory usage in renderer side to detect near-OOM situation.
|
||
|
interface OomIntervention {
|
||
|
// Starts monitoring memory usage in renderer side. When the renderer's
|
||
|
// memory usage exceeds |memory_workload_threshold| (in bytes) the renderer
|
||
|
// calls host->OnHighMemoryUsage(). The renderer also triggers OOM
|
||
|
// intervention when |trigger_intervention| is true. |shared_metrics_buffer|
|
||
|
// stores the OomInterventionMetrics struct in shared memory. The buffer is
|
||
|
// expected to be upated very often with memory metrics.
|
||
|
StartDetection(OomInterventionHost host,
|
||
|
mojo_base.mojom.UnsafeSharedMemoryRegion shared_metrics_buffer,
|
||
|
DetectionArgs detection_args,
|
||
|
bool trigger_intervention);
|
||
|
};
|