Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 11434072: Send notification from GPU process to browser process of offscreen context creation and destruction… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698