| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 5 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ->OnMessageReceived(message)) | 173 ->OnMessageReceived(message)) |
| 174 return true; | 174 return true; |
| 175 #endif | 175 #endif |
| 176 | 176 |
| 177 if (message.routing_id() != MSG_ROUTING_CONTROL) | 177 if (message.routing_id() != MSG_ROUTING_CONTROL) |
| 178 return false; | 178 return false; |
| 179 | 179 |
| 180 return OnControlMessageReceived(message); | 180 return OnControlMessageReceived(message); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void GpuProcessHostUIShim::RelinquishGpuResources( |
| 184 const base::Closure& callback) { |
| 185 DCHECK(!callback.is_null()); |
| 186 // We end up sending two messages to the GPU process. the first is handled by |
| 187 // GpuChannelManager to release the default_offscreen_surface which |
| 188 // may hold a pointer to the EGL display which is about to be released. |
| 189 // The second is sent indirectly by the Ozone platform to release all |
| 190 // remaining OpenGL and EGL resources. It calls the callback once this is |
| 191 // completed and it is safe for an external process to access the GPU. |
| 192 // A default implementation runs the callback immediately. |
| 193 Send(new GpuMsg_DeleteDefaultOffscreenSurface()); |
| 194 #if defined(USE_OZONE) |
| 195 ui::OzonePlatform::GetInstance()->RelinquishGpuResources(callback); |
| 196 #else |
| 197 callback.Run(); |
| 198 #endif |
| 199 } |
| 200 |
| 183 void GpuProcessHostUIShim::SimulateRemoveAllContext() { | 201 void GpuProcessHostUIShim::SimulateRemoveAllContext() { |
| 184 Send(new GpuMsg_Clean()); | 202 Send(new GpuMsg_Clean()); |
| 185 } | 203 } |
| 186 | 204 |
| 187 void GpuProcessHostUIShim::SimulateCrash() { | 205 void GpuProcessHostUIShim::SimulateCrash() { |
| 188 Send(new GpuMsg_Crash()); | 206 Send(new GpuMsg_Crash()); |
| 189 } | 207 } |
| 190 | 208 |
| 191 void GpuProcessHostUIShim::SimulateHang() { | 209 void GpuProcessHostUIShim::SimulateHang() { |
| 192 Send(new GpuMsg_Hang()); | 210 Send(new GpuMsg_Hang()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 #endif | 294 #endif |
| 277 } | 295 } |
| 278 | 296 |
| 279 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 297 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
| 280 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 298 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
| 281 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 299 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
| 282 video_memory_usage_stats); | 300 video_memory_usage_stats); |
| 283 } | 301 } |
| 284 | 302 |
| 285 } // namespace content | 303 } // namespace content |
| OLD | NEW |