// 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); }; // 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, uint64 memory_workload_threshold, bool trigger_intervention); };