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 ef4fea313dffd423a165ce15f1f8a23bed1cf374..bea5caed94d5471c1ef68fb8cd0bde5d1715829c 100644 |
--- a/content/browser/gpu/gpu_process_host.cc |
+++ b/content/browser/gpu/gpu_process_host.cc |
@@ -451,11 +451,6 @@ GpuProcessHost::~GpuProcessHost() { |
if (g_gpu_process_hosts[kind_] == this) |
g_gpu_process_hosts[kind_] = NULL; |
- // If there are any remaining offscreen contexts at the point the |
- // GPU process exits, assume something went wrong, and block their |
- // URLs from accessing client 3D APIs without prompting. |
- BlockLiveOffscreenContexts(); |
- |
UMA_HISTOGRAM_COUNTS_100("GPU.AtExitSurfaceCount", |
GpuSurfaceTracker::Get()->GetSurfaceCount()); |
UMA_HISTOGRAM_BOOLEAN("GPU.AtExitReceivedMemoryStats", |
@@ -473,6 +468,7 @@ GpuProcessHost::~GpuProcessHost() { |
} |
std::string message; |
+ bool block_offscreen_contexts = true; |
if (!in_process_) { |
int exit_code; |
base::TerminationStatus status = process_->GetTerminationStatus( |
@@ -490,6 +486,13 @@ GpuProcessHost::~GpuProcessHost() { |
switch (status) { |
case base::TERMINATION_STATUS_NORMAL_TERMINATION: |
+#if defined(OS_ANDROID) |
no sievers
2016/03/01 23:04:34
I'm wondering if this even needs the ifdef Android
Ken Russell (switch to Gerrit)
2016/03/02 00:48:47
You're right, it's probably not needed. The only t
|
+ // Don't block offscreen contexts (and force page reload for webgl) |
+ // if we might have gotten killed by the OOM killer. |
+ // Note that NORMAL_TERMINATION here implies that the browser |
+ // was backgrounded (or we'd be TERMINATION_STATUS_OOM_PROTECTED). |
+ block_offscreen_contexts = false; |
+#endif |
message = "The GPU process exited normally. Everything is okay."; |
break; |
case base::TERMINATION_STATUS_ABNORMAL_TERMINATION: |
@@ -516,6 +519,12 @@ GpuProcessHost::~GpuProcessHost() { |
} |
} |
+ // If there are any remaining offscreen contexts at the point the |
+ // GPU process exits, assume something went wrong, and block their |
+ // URLs from accessing client 3D APIs without prompting. |
+ if (block_offscreen_contexts) |
+ BlockLiveOffscreenContexts(); |
+ |
BrowserThread::PostTask(BrowserThread::UI, |
FROM_HERE, |
base::Bind(&GpuProcessHostUIShim::Destroy, |