Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host_ui_shim.cc |
| diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc |
| index 8c4450628e7885b8275398a0659b4d9867022fd5..a5850c1ec70b20fbc2f9dc5981532bb14ea5775b 100644 |
| --- a/content/browser/gpu/gpu_process_host_ui_shim.cc |
| +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc |
| @@ -7,6 +7,7 @@ |
| #include <algorithm> |
| #include "base/bind.h" |
| +#include "base/callback_helpers.h" |
| #include "base/debug/trace_event.h" |
| #include "base/id_map.h" |
| #include "base/lazy_instance.h" |
| @@ -180,6 +181,13 @@ bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { |
| return OnControlMessageReceived(message); |
| } |
| +void GpuProcessHostUIShim::RelinquishGpuResources( |
| + const base::Closure& callback) { |
|
dcheng
2014/11/21 03:06:03
Nit: this indent should be 4 spaces.
GusFernandez
2014/11/21 19:13:56
Done.
|
| + DCHECK(relinquish_callback_.is_null()); |
| + relinquish_callback_ = callback; |
| + Send(new GpuMsg_RelinquishResources()); |
| +} |
| + |
| void GpuProcessHostUIShim::SimulateRemoveAllContext() { |
| Send(new GpuMsg_Clean()); |
| } |
| @@ -212,6 +220,8 @@ bool GpuProcessHostUIShim::OnControlMessageReceived( |
| OnGraphicsInfoCollected) |
| IPC_MESSAGE_HANDLER(GpuHostMsg_VideoMemoryUsageStats, |
| OnVideoMemoryUsageStatsReceived); |
| + IPC_MESSAGE_HANDLER(GpuHostMsg_ResourcesRelinquished, |
| + OnResourcesRelinquished) |
| IPC_MESSAGE_UNHANDLED_ERROR() |
| IPC_END_MESSAGE_MAP() |
| @@ -282,4 +292,10 @@ void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| video_memory_usage_stats); |
| } |
| +void GpuProcessHostUIShim::OnResourcesRelinquished() { |
| + if (!relinquish_callback_.is_null()) { |
| + base::ResetAndReturn(&relinquish_callback_).Run(); |
| + } |
| +} |
| + |
| } // namespace content |