1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef xpcom_base_MemoryReportingProcess_h
8 #define xpcom_base_MemoryReportingProcess_h
9 
10 #include <stdint.h>
11 #include "nscore.h"
12 
13 namespace mozilla {
14 namespace ipc {
15 class FileDescriptor;
16 }  // namespace ipc
17 
18 template <class T>
19 class Maybe;
20 
21 // Top-level process actors should implement this to integrate with
22 // nsMemoryReportManager.
23 class MemoryReportingProcess {
24  public:
25   NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
26   NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
27 
28   virtual ~MemoryReportingProcess() = default;
29 
30   // Return true if the process is still alive, false otherwise.
31   virtual bool IsAlive() const = 0;
32 
33   // Initiate a memory report request, returning true if a report was
34   // successfully initiated and false otherwise.
35   virtual bool SendRequestMemoryReport(
36       const uint32_t& aGeneration, const bool& aAnonymize,
37       const bool& aMinimizeMemoryUsage,
38       const Maybe<mozilla::ipc::FileDescriptor>& aDMDFile) = 0;
39 
40   virtual int32_t Pid() const = 0;
41 };
42 
43 }  // namespace mozilla
44 
45 #endif  // xpcom_base_MemoryReportingProcess_h
46