Index: cc/tiles/software_image_decode_controller.cc |
diff --git a/cc/tiles/software_image_decode_controller.cc b/cc/tiles/software_image_decode_controller.cc |
index 4d0ca7e851711a6583bb48517264e029ec11555c..3a5f6017bf1cde0146f69a8c4cd29acb7ac9e8a2 100644 |
--- a/cc/tiles/software_image_decode_controller.cc |
+++ b/cc/tiles/software_image_decode_controller.cc |
@@ -10,6 +10,7 @@ |
#include <algorithm> |
#include <functional> |
+#include "base/allocator/allocator_extension.h" |
#include "base/format_macros.h" |
#include "base/macros.h" |
#include "base/memory/discardable_memory.h" |
@@ -154,6 +155,9 @@ SoftwareImageDecodeController::SoftwareImageDecodeController( |
this, "cc::SoftwareImageDecodeController", |
base::ThreadTaskRunnerHandle::Get()); |
} |
+ memory_pressure_listener_.reset(new base::MemoryPressureListener( |
+ base::Bind(&SoftwareImageDecodeController::OnMemoryPressure, |
+ base::Unretained(this)))); |
} |
SoftwareImageDecodeController::~SoftwareImageDecodeController() { |
@@ -700,6 +704,13 @@ bool SoftwareImageDecodeController::OnMemoryDump( |
return true; |
} |
+void SoftwareImageDecodeController::OnMemoryPressure( |
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { |
+ decoded_images_.Clear(); |
+ at_raster_decoded_images_.Clear(); |
+ base::allocator::ReleaseFreeMemory(); |
+} |
+ |
void SoftwareImageDecodeController::DumpImageMemoryForCache( |
const ImageMRUCache& cache, |
const char* cache_name, |