resource_manager.mojom 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module crosapi.mojom;
  5. // Memory pressure level corresponding to MemoryPressureLevel in
  6. // base/memory/memory_pressure_listener.h
  7. [Stable, Extensible]
  8. enum MemoryPressureLevel {
  9. kNone = 0,
  10. kModerate = 1,
  11. kCritical = 2,
  12. };
  13. // Memory pressure status.
  14. [Stable]
  15. struct MemoryPressure {
  16. MemoryPressureLevel level@0;
  17. // The amount of memory to reclaim to reduce the memory pressure level.
  18. uint64 reclaim_target_kb@1;
  19. };
  20. // Interface for memory pressure observers. Implemented by lacros-chrome. Used
  21. // by ash-chrome to send memory pressure status.
  22. [Stable, Uuid="51b994bb-278f-4df3-9393-2732f2a0dcb3"]
  23. interface MemoryPressureObserver {
  24. // Called when memory pressure status changes.
  25. MemoryPressure@0(MemoryPressure pressure);
  26. };
  27. // Interface to manage chrome resource, e.g. Memory. Implemented by ash-chrome.
  28. [Stable, Uuid="3908db1e-304d-4615-a331-f2f262745bc3"]
  29. interface ResourceManager {
  30. // Adds an observer for memory pressure status.
  31. AddMemoryPressureObserver@0(pending_remote<MemoryPressureObserver> observer);
  32. };