diff options
author | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 16:30:02 +0000 |
---|---|---|
committer | michaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 16:30:02 +0000 |
commit | 5a131334fd2821c83b3e92510e734738e254d3ac (patch) | |
tree | 8eb04916baf8bc238af044cda2220e4fe6523bd9 /android_webview/browser | |
parent | 2ba61641943939d40a31e79ea775fb00e04692bb (diff) | |
download | chromium_src-5a131334fd2821c83b3e92510e734738e254d3ac.zip chromium_src-5a131334fd2821c83b3e92510e734738e254d3ac.tar.gz chromium_src-5a131334fd2821c83b3e92510e734738e254d3ac.tar.bz2 |
Merge 272500 "aw: Fix hardware init/tear down in pop up flow"
> 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
TBR=boliu@chromium.org
Review URL: https://codereview.chromium.org/307943005
git-svn-id: svn://svn.chromium.org/chrome/branches/1985/src@273487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/browser')
-rw-r--r-- | android_webview/browser/gl_view_renderer_manager.cc | 5 | ||||
-rw-r--r-- | android_webview/browser/gl_view_renderer_manager.h | 4 | ||||
-rw-r--r-- | android_webview/browser/shared_renderer_state.cc | 22 | ||||
-rw-r--r-- | android_webview/browser/shared_renderer_state.h | 13 |
4 files changed, 16 insertions, 28 deletions
diff --git a/android_webview/browser/gl_view_renderer_manager.cc b/android_webview/browser/gl_view_renderer_manager.cc index b9d1a83..204239c 100644 --- a/android_webview/browser/gl_view_renderer_manager.cc +++ b/android_webview/browser/gl_view_renderer_manager.cc @@ -25,6 +25,11 @@ GLViewRendererManager::GLViewRendererManager() {} GLViewRendererManager::~GLViewRendererManager() {} +GLViewRendererManager::Key GLViewRendererManager::NullKey() { + AutoLock auto_lock(lock_); + return mru_list_.end(); +} + GLViewRendererManager::Key GLViewRendererManager::PushBack(RendererType view) { AutoLock auto_lock(lock_); DCHECK(mru_list_.end() == diff --git a/android_webview/browser/gl_view_renderer_manager.h b/android_webview/browser/gl_view_renderer_manager.h index 5d6cb8d..f34d9cb 100644 --- a/android_webview/browser/gl_view_renderer_manager.h +++ b/android_webview/browser/gl_view_renderer_manager.h @@ -28,9 +28,7 @@ class GLViewRendererManager { static GLViewRendererManager* GetInstance(); - Key NullKey() { - return mru_list_.end(); - } + Key NullKey(); Key PushBack(RendererType view); 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<base::Closure> 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) { diff --git a/android_webview/browser/shared_renderer_state.h b/android_webview/browser/shared_renderer_state.h index 9c90731..7959541 100644 --- a/android_webview/browser/shared_renderer_state.h +++ b/android_webview/browser/shared_renderer_state.h @@ -5,9 +5,6 @@ #ifndef ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ #define ANDROID_WEBVIEW_BROWSER_SHARED_RENDERER_STATE_H_ -#include <queue> - -#include "base/callback.h" #include "base/message_loop/message_loop_proxy.h" #include "base/synchronization/lock.h" #include "content/public/browser/android/synchronous_compositor.h" @@ -64,11 +61,11 @@ class SharedRendererState { void SetDrawGLInput(const DrawGLInput& input); DrawGLInput GetDrawGLInput() const; - void ClearClosureQueue(); - void AppendClosure(const base::Closure& closure); - // Will return empty closure if queue empty. - base::Closure PopFrontClosure(); + // Set by UI and read by RT. + void SetHardwareAllowed(bool allowed); + bool IsHardwareAllowed() const; + // Set by RT and read by UI. void SetHardwareInitialized(bool initialized); bool IsHardwareInitialized() const; @@ -89,7 +86,7 @@ class SharedRendererState { // Set to false when memory policy is read and enforced to compositor. bool memory_policy_dirty_; DrawGLInput draw_gl_input_; - std::queue<base::Closure> closure_queue_; + bool hardware_allowed_; bool hardware_initialized_; }; |