summaryrefslogtreecommitdiffstats
path: root/android_webview/native/aw_contents.cc
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-08 09:43:57 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-08 09:45:30 +0000
commit8c016b610caded6dea9354e88515025e6ad52ab9 (patch)
treefe19cc750f29f999b417f935d45abc0e6e65ff73 /android_webview/native/aw_contents.cc
parenteb7928a731f7f9a7282fcb503295d37e5a8ce1eb (diff)
downloadchromium_src-8c016b610caded6dea9354e88515025e6ad52ab9.zip
chromium_src-8c016b610caded6dea9354e88515025e6ad52ab9.tar.gz
chromium_src-8c016b610caded6dea9354e88515025e6ad52ab9.tar.bz2
aw: Improve idle task scheduling
Three related changes: * Only run idle tasks in the queue, not newly added ones. * Move g_request_pending logic to SharedRendererState. This allows pending tasks to be cancelled correctly. * Wait for kModeProcess to happen first before trying to request another to avoid a queue of pending tasks. BUG=401712 Review URL: https://codereview.chromium.org/444173003 Cr-Commit-Position: refs/heads/master@{#288285} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288285 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/native/aw_contents.cc')
-rw-r--r--android_webview/native/aw_contents.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index fdddf9f..0803f75 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;
}