Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host.cc |
| diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
| index 8de01641562c05bfe762f3aa058139fc03540287..b7bdc4bafddc9040884d808daffcc14a4435a0b9 100644 |
| --- a/content/browser/gpu/gpu_process_host.cc |
| +++ b/content/browser/gpu/gpu_process_host.cc |
| @@ -507,6 +507,11 @@ bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { |
| IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) |
| IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) |
| IPC_MESSAGE_HANDLER(GpuHostMsg_ImageCreated, OnImageCreated) |
| + IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, |
| + OnDidCreateOffscreenContext) |
| + IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) |
| + IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, |
| + OnDidDestroyOffscreenContext) |
| #if defined(OS_MACOSX) |
| IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, |
| OnAcceleratedSurfaceBuffersSwapped) |
| @@ -686,6 +691,56 @@ void GpuProcessHost::OnImageCreated(const gfx::Size size) { |
| } |
| } |
| +void GpuProcessHost::OnDidCreateOffscreenContext( |
| + const GURL& containing_document_url) { |
| + urls_with_live_offscreen_contexts_.insert(containing_document_url); |
| +} |
| + |
| +void GpuProcessHost::OnDidLoseContext(bool offscreen, |
| + gpu::error::ContextLostReason reason, |
| + const GURL& containing_document_url) { |
| + // TODO(kbr): would be nice to see the "offscreen" flag too. |
| + TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", |
| + "reason", reason, |
| + "containing_document_url", |
| + containing_document_url.possibly_invalid_spec()); |
| + |
| + if (!offscreen) { |
| + // Assume that the loss of the compositor's context is a serious |
| + // event and blame the loss on all live offscreen contexts. This |
| + // more robustly handles situations where the GPU process may not |
| + // actually detect the context loss in the offscreen context. |
| + for (std::multiset<GURL>::iterator iter = |
| + urls_with_live_offscreen_contexts_.begin(); |
| + iter != urls_with_live_offscreen_contexts_.end(); ++iter) { |
|
apatrick
2012/12/03 20:35:33
If the GPU process crashes, the GpuProcessHost is
Ken Russell (switch to Gerrit)
2012/12/04 05:11:50
Good point. As it happens, the mechanism I added i
|
| + GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( |
|
apatrick
2012/12/03 20:35:33
I see BlockDomainFrom3DAPIs takes an AutoLock and
Ken Russell (switch to Gerrit)
2012/12/04 05:11:50
Yes, understood, and this is what was intended.
|
| + *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); |
| + } |
| + return; |
| + } |
| + |
| + GpuDataManagerImpl::DomainGuilt guilt; |
| + |
| + switch (reason) { |
| + case gpu::error::kGuilty: |
| + guilt = GpuDataManagerImpl::DOMAIN_GUILT_KNOWN; |
| + break; |
| + case gpu::error::kUnknown: |
| + guilt = GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN; |
| + break; |
| + case gpu::error::kInnocent: |
| + return; |
| + } |
| + |
| + GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( |
| + containing_document_url, guilt); |
| +} |
| + |
| +void GpuProcessHost::OnDidDestroyOffscreenContext( |
| + const GURL& containing_document_url) { |
| + urls_with_live_offscreen_contexts_.erase(containing_document_url); |
| +} |
| + |
| #if defined(OS_MACOSX) |
| void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( |
| const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { |