Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index fdddf9f23fccfa20e67ca79ada7858264a0ca604..0803f75f1cd9725fee6843f1a5bae6a605ac6caa 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -362,11 +362,24 @@ void AwContents::DrawGL(AwDrawGLInfo* draw_info) { |
: ScopedAppGLStateRestore::MODE_RESOURCE_MANAGEMENT); |
ScopedAllowGL allow_gl; |
+ if (draw_info->mode == AwDrawGLInfo::kModeProcessNoContext) { |
+ LOG(ERROR) << "Received unexpected kModeProcessNoContext"; |
+ } |
+ |
+ // kModeProcessNoContext should never happen because we tear down hardware |
+ // in onTrimMemory. However that guarantee is maintained outside of chromium |
+ // code. Not notifying shared state in kModeProcessNoContext can lead to |
+ // immediate deadlock, which is slightly more catastrophic than leaks or |
+ // corruption. |
+ if (draw_info->mode == AwDrawGLInfo::kModeProcess || |
+ draw_info->mode == AwDrawGLInfo::kModeProcessNoContext) { |
+ shared_renderer_state_.DidDrawGLProcess(); |
+ } |
+ |
if (shared_renderer_state_.IsInsideHardwareRelease()) { |
hardware_renderer_.reset(); |
// Flush the idle queue in tear down. |
- DeferredGpuCommandService::GetInstance()->PerformIdleWork(true); |
- DCHECK(!DeferredGpuCommandService::GetInstance()->HasIdleWork()); |
+ DeferredGpuCommandService::GetInstance()->PerformAllIdleWork(); |
return; |
} |