memory_pressure_monitor.cc 697 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2015 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. #include "base/memory/memory_pressure_monitor.h"
  5. #include "base/check.h"
  6. #include "base/metrics/histogram.h"
  7. #include "base/notreached.h"
  8. namespace base {
  9. namespace {
  10. MemoryPressureMonitor* g_monitor = nullptr;
  11. } // namespace
  12. MemoryPressureMonitor::MemoryPressureMonitor() {
  13. DCHECK(!g_monitor);
  14. g_monitor = this;
  15. }
  16. MemoryPressureMonitor::~MemoryPressureMonitor() {
  17. DCHECK(g_monitor);
  18. g_monitor = nullptr;
  19. }
  20. // static
  21. MemoryPressureMonitor* MemoryPressureMonitor::Get() {
  22. return g_monitor;
  23. }
  24. } // namespace base