From 99d37d120bc514bbe863c7efef2d7459852f5b92 Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Wed, 16 Feb 2022 09:34:42 +0000 Subject: [PATCH] Bug 1753635 - Add process bookkeeping about memory reporter r=handyman Differential Revision: https://phabricator.services.mozilla.com/D138598 --- ipc/docs/ipdl.rst | 2 ++ ipc/docs/processes.rst | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ipc/docs/ipdl.rst b/ipc/docs/ipdl.rst index e2b6e252dcf3..57cc6c9ccd7c 100644 --- a/ipc/docs/ipdl.rst +++ b/ipc/docs/ipdl.rst @@ -768,6 +768,8 @@ Consider actors to be like normal reference-counted objects, but where IPDL hold The dual of IPDL holding the only reference is to have client code hold the only reference. A common pattern to achieve this has been to override the actor's ``AddRef`` to have it send ``__delete__`` only when it's count is down to one reference (which must be IPDL if ``actor.CanSend()`` is true). A better approach would be to create a reference-counted delegate for your actor that can send ``__delete__`` from its destructor. IPDL does not guarantee that it will not hold more than one reference to your actor. +.. _Top Level Actors: + Top Level Actors ---------------- diff --git a/ipc/docs/processes.rst b/ipc/docs/processes.rst index e2db59ed2966..c7bbb4f3d2e3 100644 --- a/ipc/docs/processes.rst +++ b/ipc/docs/processes.rst @@ -131,9 +131,29 @@ Crash reporting - Add entry in `PROCESS_CRASH_SUBMIT_ATTEMPT `_ Memory reporting -################# +################ -- Add handling for your new process within `nsMemoryReporterManager::GetReportsExtended ` +Throughout the linked code, please consider those methods more as boilerplate code that will require some trivial modification to fit your exact usecase. + +- Add definition of memory reporter to your new :ref:`top-level actor ` + + + Type inclusion `MemoryReportTypes `_ + + To parent-side `AddMemoryReport `_ + + To child-side `RequestMemoryReport `_ + +- Add handling for your new process within `nsMemoryReporterManager::GetReportsExtended `_ +- Provide a process manager level abstraction + + + Implement a new class deriving ``MemoryReportingProcess`` such as `UtilityMemoryReporter `_ + + Write a `GetProcessMemoryReport `_ + +- On the child side, provide an implementation for `RequestMemoryReport `_ +- On the parent side + + + Provide an implementation for `RequestMemoryReport `_ + + Provide an implementation for `AddMemoryReport `_ + +If you want to add a test that ensures proper behavior, you can have a look at the `utility process memory report test `_ Process reporting #################