From d6417554055d96c69580ff60a9d83c1cfc99c1b4 Mon Sep 17 00:00:00 2001 From: "boliu@chromium.org" Date: Fri, 23 May 2014 11:55:47 +0000 Subject: aw: Fix hardware init/tear down in pop up flow Previously we did not call onDetached on old native AwContents, which now no longer cleans up hardware resources correctly. This also had the side effect that the following onAttach with the new native AwContents is ignored in java code due to attach/detach mismatch. As make onDetached more strict with respect to ordering. And lock to protect variable accessed on multiple threads. Also need to ensure we never requestDrawGL on the blank native AwContents that's destroyed during pop up. BUG=376622 Review URL: https://codereview.chromium.org/288983007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272500 0039d316-1c4b-4281-b951-d872f2087c98 --- android_webview/browser/shared_renderer_state.cc | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'android_webview/browser/shared_renderer_state.cc') diff --git a/android_webview/browser/shared_renderer_state.cc b/android_webview/browser/shared_renderer_state.cc index 3483d63..193eca0 100644 --- a/android_webview/browser/shared_renderer_state.cc +++ b/android_webview/browser/shared_renderer_state.cc @@ -23,6 +23,7 @@ SharedRendererState::SharedRendererState( ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()), compositor_(NULL), memory_policy_dirty_(false), + hardware_allowed_(false), hardware_initialized_(false) { DCHECK(ui_loop_->BelongsToCurrentThread()); DCHECK(client_on_ui_); @@ -86,27 +87,14 @@ DrawGLInput SharedRendererState::GetDrawGLInput() const { return draw_gl_input_; } -void SharedRendererState::ClearClosureQueue() { +void SharedRendererState::SetHardwareAllowed(bool allowed) { base::AutoLock lock(lock_); - std::queue empty; - std::swap(closure_queue_, empty); + hardware_allowed_ = allowed; } -void SharedRendererState::AppendClosure(const base::Closure& closure) { +bool SharedRendererState::IsHardwareAllowed() const { base::AutoLock lock(lock_); - closure_queue_.push(closure); -} - -base::Closure SharedRendererState::PopFrontClosure() { - base::Closure closure; - - base::AutoLock lock(lock_); - if (!closure_queue_.empty()) { - closure = closure_queue_.front(); - closure_queue_.pop(); - } - - return closure; + return hardware_allowed_; } void SharedRendererState::SetHardwareInitialized(bool initialized) { -- cgit v1.1