fake_memory_pressure_monitor.cc 1003 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2018 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 "components/memory_pressure/fake_memory_pressure_monitor.h"
  5. #include "base/logging.h"
  6. namespace memory_pressure {
  7. namespace test {
  8. FakeMemoryPressureMonitor::FakeMemoryPressureMonitor() = default;
  9. FakeMemoryPressureMonitor::~FakeMemoryPressureMonitor() = default;
  10. void FakeMemoryPressureMonitor::SetAndNotifyMemoryPressure(
  11. MemoryPressureLevel level) {
  12. memory_pressure_level_ = level;
  13. base::MemoryPressureListener::SimulatePressureNotification(level);
  14. }
  15. base::MemoryPressureMonitor::MemoryPressureLevel
  16. FakeMemoryPressureMonitor::GetCurrentPressureLevel() const {
  17. return memory_pressure_level_;
  18. }
  19. void FakeMemoryPressureMonitor::SetDispatchCallback(
  20. const DispatchCallback& callback) {
  21. LOG(ERROR) << "FakeMemoryPressureMonitor::SetDispatchCallback";
  22. }
  23. } // namespace test
  24. } // namespace memory_pressure