| 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);
|
|
|