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

Unified Diff: cc/tiles/gpu_image_decode_controller.cc

Issue 2130683002: [Experiment] purge-and-suspend Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/gpu_image_decode_controller.cc
diff --git a/cc/tiles/gpu_image_decode_controller.cc b/cc/tiles/gpu_image_decode_controller.cc
index 1c213d52faa49cff619ce8a9c54e347d42260f67..a2db4c110c4ddbfe0e34c3d28f22f5e86375e968 100644
--- a/cc/tiles/gpu_image_decode_controller.cc
+++ b/cc/tiles/gpu_image_decode_controller.cc
@@ -6,6 +6,7 @@
#include <inttypes.h>
+#include "base/allocator/allocator_extension.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
@@ -358,6 +359,8 @@ GpuImageDecodeController::GpuImageDecodeController(ContextProvider* context,
this, "cc::GpuImageDecodeController",
base::ThreadTaskRunnerHandle::Get());
}
+ memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind(
+ &GpuImageDecodeController::OnMemoryPressure, base::Unretained(this))));
}
GpuImageDecodeController::~GpuImageDecodeController() {
@@ -593,6 +596,12 @@ bool GpuImageDecodeController::OnMemoryDump(
return true;
}
+void GpuImageDecodeController::OnMemoryPressure(
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
+ SetShouldAggressivelyFreeResources(true);
+ base::allocator::ReleaseFreeMemory();
+}
+
void GpuImageDecodeController::DecodeImage(const DrawImage& draw_image) {
base::AutoLock lock(lock_);
ImageData* image_data = GetImageDataForDrawImage(draw_image);

Powered by Google App Engine
This is Rietveld 408576698