Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Unified Diff: cc/tiles/software_image_decode_controller.cc

Issue 2130683002: [Experiment] purge-and-suspend Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698