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 // We end up sending two messages to the GPU process. the first is handled by | |
186 // GpuChannelManager to release the default_offscreen_surface which | |
187 // may hold a pointer to the EGL display which is about to be released. | |
188 // The second is sent indirectly by the Ozone platform to release all | |
189 // remaining OpenGL and EGL resources. It calls the optional callback once | |
190 // this is completed and it is safe for an external process to access the GPU. | |
191 // A default implementation runs the callback immediately. | |
192 Send(new GpuMsg_DeleteDefaultOffscreenSurface()); | |
piman
2014/11/18 20:55:34
Would you not want to wait for an ack before calli
GusFernandez
2014/11/19 18:50:13
This is done effectively by the next call. We only
piman
2014/11/19 20:33:52
But that's not true on !OZONE
| |
193 #if defined(USE_OZONE) | |
194 ui::OzonePlatform::GetInstance()->RelinquishGpuResources(callback); | |
195 #else | |
196 if (!callback.is_null()) { | |
197 callback.Run(); | |
198 } | |
199 #endif | |
200 } | |
201 | |
183 void GpuProcessHostUIShim::SimulateRemoveAllContext() { | 202 void GpuProcessHostUIShim::SimulateRemoveAllContext() { |
184 Send(new GpuMsg_Clean()); | 203 Send(new GpuMsg_Clean()); |
185 } | 204 } |
186 | 205 |
187 void GpuProcessHostUIShim::SimulateCrash() { | 206 void GpuProcessHostUIShim::SimulateCrash() { |
188 Send(new GpuMsg_Crash()); | 207 Send(new GpuMsg_Crash()); |
189 } | 208 } |
190 | 209 |
191 void GpuProcessHostUIShim::SimulateHang() { | 210 void GpuProcessHostUIShim::SimulateHang() { |
192 Send(new GpuMsg_Hang()); | 211 Send(new GpuMsg_Hang()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 #endif | 295 #endif |
277 } | 296 } |
278 | 297 |
279 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( | 298 void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
280 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 299 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
281 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( | 300 GpuDataManagerImpl::GetInstance()->UpdateVideoMemoryUsageStats( |
282 video_memory_usage_stats); | 301 video_memory_usage_stats); |
283 } | 302 } |
284 | 303 |
285 } // namespace content | 304 } // namespace content |
OLD | NEW |