| OLD | NEW |
| (Empty) |
| 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 | |
| 5 #include "components/memory_pressure/test_memory_pressure_calculator.h" | |
| 6 | |
| 7 namespace memory_pressure { | |
| 8 | |
| 9 #if defined(MEMORY_PRESSURE_IS_POLLING) | |
| 10 | |
| 11 TestMemoryPressureCalculator::TestMemoryPressureCalculator() | |
| 12 : level_(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE), calls_(0) {} | |
| 13 | |
| 14 TestMemoryPressureCalculator::TestMemoryPressureCalculator( | |
| 15 MemoryPressureLevel level) | |
| 16 : level_(level), calls_(0) {} | |
| 17 | |
| 18 TestMemoryPressureCalculator::MemoryPressureLevel | |
| 19 TestMemoryPressureCalculator::CalculateCurrentPressureLevel() { | |
| 20 ++calls_; | |
| 21 return level_; | |
| 22 } | |
| 23 | |
| 24 void TestMemoryPressureCalculator::SetLevel(MemoryPressureLevel level) { | |
| 25 level_ = level; | |
| 26 } | |
| 27 | |
| 28 void TestMemoryPressureCalculator::SetNone() { | |
| 29 level_ = MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE; | |
| 30 } | |
| 31 | |
| 32 void TestMemoryPressureCalculator::SetModerate() { | |
| 33 level_ = MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE; | |
| 34 } | |
| 35 | |
| 36 void TestMemoryPressureCalculator::SetCritical() { | |
| 37 level_ = MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL; | |
| 38 } | |
| 39 | |
| 40 void TestMemoryPressureCalculator::ResetCalls() { | |
| 41 calls_ = 0; | |
| 42 } | |
| 43 | |
| 44 #endif // defined(MEMORY_PRESSURE_IS_POLLING) | |
| 45 | |
| 46 } // namespace memory_pressure | |
| OLD | NEW |