| Index: android_webview/browser/render_thread_manager.cc
|
| diff --git a/android_webview/browser/render_thread_manager.cc b/android_webview/browser/render_thread_manager.cc
|
| index df7331a19a64058a3e1f9e0db7831fdbcff52cf8..94d74c6bff33e024b71634f1a0089d483912e83f 100644
|
| --- a/android_webview/browser/render_thread_manager.cc
|
| +++ b/android_webview/browser/render_thread_manager.cc
|
| @@ -22,9 +22,9 @@ namespace android_webview {
|
|
|
| namespace internal {
|
|
|
| -class RequestDrawGLTracker {
|
| +class RequestInvokeGLTracker {
|
| public:
|
| - RequestDrawGLTracker();
|
| + RequestInvokeGLTracker();
|
| bool ShouldRequestOnNonUiThread(RenderThreadManager* state);
|
| bool ShouldRequestOnUiThread(RenderThreadManager* state);
|
| void ResetPending();
|
| @@ -36,11 +36,10 @@ class RequestDrawGLTracker {
|
| RenderThreadManager* pending_non_ui_;
|
| };
|
|
|
| -RequestDrawGLTracker::RequestDrawGLTracker()
|
| - : pending_ui_(NULL), pending_non_ui_(NULL) {
|
| -}
|
| +RequestInvokeGLTracker::RequestInvokeGLTracker()
|
| + : pending_ui_(NULL), pending_non_ui_(NULL) {}
|
|
|
| -bool RequestDrawGLTracker::ShouldRequestOnNonUiThread(
|
| +bool RequestInvokeGLTracker::ShouldRequestOnNonUiThread(
|
| RenderThreadManager* state) {
|
| base::AutoLock lock(lock_);
|
| if (pending_ui_ || pending_non_ui_)
|
| @@ -49,28 +48,30 @@ bool RequestDrawGLTracker::ShouldRequestOnNonUiThread(
|
| return true;
|
| }
|
|
|
| -bool RequestDrawGLTracker::ShouldRequestOnUiThread(RenderThreadManager* state) {
|
| +bool RequestInvokeGLTracker::ShouldRequestOnUiThread(
|
| + RenderThreadManager* state) {
|
| base::AutoLock lock(lock_);
|
| if (pending_non_ui_) {
|
| - pending_non_ui_->ResetRequestDrawGLCallback();
|
| + pending_non_ui_->ResetRequestInvokeGLCallback();
|
| pending_non_ui_ = NULL;
|
| }
|
| - // At this time, we could have already called RequestDrawGL on the UI thread,
|
| + // At this time, we could have already called RequestInvokeGL on the UI
|
| + // thread,
|
| // but the corresponding GL mode process hasn't happened yet. In this case,
|
| - // don't schedule another requestDrawGL on the UI thread.
|
| + // don't schedule another requestInvokeGL on the UI thread.
|
| if (pending_ui_)
|
| return false;
|
| pending_ui_ = state;
|
| return true;
|
| }
|
|
|
| -void RequestDrawGLTracker::ResetPending() {
|
| +void RequestInvokeGLTracker::ResetPending() {
|
| base::AutoLock lock(lock_);
|
| pending_non_ui_ = NULL;
|
| pending_ui_ = NULL;
|
| }
|
|
|
| -void RequestDrawGLTracker::SetQueuedFunctorOnUi(RenderThreadManager* state) {
|
| +void RequestInvokeGLTracker::SetQueuedFunctorOnUi(RenderThreadManager* state) {
|
| base::AutoLock lock(lock_);
|
| DCHECK(state);
|
| pending_ui_ = state;
|
| @@ -81,9 +82,8 @@ void RequestDrawGLTracker::SetQueuedFunctorOnUi(RenderThreadManager* state) {
|
|
|
| namespace {
|
|
|
| -base::LazyInstance<internal::RequestDrawGLTracker> g_request_draw_gl_tracker =
|
| - LAZY_INSTANCE_INITIALIZER;
|
| -
|
| +base::LazyInstance<internal::RequestInvokeGLTracker>
|
| + g_request_invoke_gl_tracker = LAZY_INSTANCE_INITIALIZER;
|
| }
|
|
|
| RenderThreadManager::RenderThreadManager(
|
| @@ -98,7 +98,7 @@ RenderThreadManager::RenderThreadManager(
|
| DCHECK(ui_loop_->BelongsToCurrentThread());
|
| DCHECK(client_);
|
| ui_thread_weak_ptr_ = weak_factory_on_ui_thread_.GetWeakPtr();
|
| - ResetRequestDrawGLCallback();
|
| + ResetRequestInvokeGLCallback();
|
| }
|
|
|
| RenderThreadManager::~RenderThreadManager() {
|
| @@ -106,13 +106,13 @@ RenderThreadManager::~RenderThreadManager() {
|
| DCHECK(!hardware_renderer_.get());
|
| }
|
|
|
| -void RenderThreadManager::ClientRequestDrawGL(bool for_idle) {
|
| +void RenderThreadManager::ClientRequestInvokeGL(bool for_idle) {
|
| if (ui_loop_->BelongsToCurrentThread()) {
|
| - if (!g_request_draw_gl_tracker.Get().ShouldRequestOnUiThread(this))
|
| + if (!g_request_invoke_gl_tracker.Get().ShouldRequestOnUiThread(this))
|
| return;
|
| - ClientRequestDrawGLOnUI();
|
| + ClientRequestInvokeGLOnUI();
|
| } else {
|
| - if (!g_request_draw_gl_tracker.Get().ShouldRequestOnNonUiThread(this))
|
| + if (!g_request_invoke_gl_tracker.Get().ShouldRequestOnNonUiThread(this))
|
| return;
|
| base::Closure callback;
|
| {
|
| @@ -128,24 +128,24 @@ void RenderThreadManager::ClientRequestDrawGL(bool for_idle) {
|
| }
|
| }
|
|
|
| -void RenderThreadManager::DidDrawGLProcess() {
|
| - g_request_draw_gl_tracker.Get().ResetPending();
|
| +void RenderThreadManager::DidInvokeGLProcess() {
|
| + g_request_invoke_gl_tracker.Get().ResetPending();
|
| }
|
|
|
| -void RenderThreadManager::ResetRequestDrawGLCallback() {
|
| +void RenderThreadManager::ResetRequestInvokeGLCallback() {
|
| DCHECK(ui_loop_->BelongsToCurrentThread());
|
| base::AutoLock lock(lock_);
|
| request_draw_gl_cancelable_closure_.Reset(base::Bind(
|
| - &RenderThreadManager::ClientRequestDrawGLOnUI, base::Unretained(this)));
|
| + &RenderThreadManager::ClientRequestInvokeGLOnUI, base::Unretained(this)));
|
| request_draw_gl_closure_ = request_draw_gl_cancelable_closure_.callback();
|
| }
|
|
|
| -void RenderThreadManager::ClientRequestDrawGLOnUI() {
|
| +void RenderThreadManager::ClientRequestInvokeGLOnUI() {
|
| DCHECK(ui_loop_->BelongsToCurrentThread());
|
| - ResetRequestDrawGLCallback();
|
| - g_request_draw_gl_tracker.Get().SetQueuedFunctorOnUi(this);
|
| - if (!client_->RequestDrawGL(false)) {
|
| - g_request_draw_gl_tracker.Get().ResetPending();
|
| + ResetRequestInvokeGLCallback();
|
| + g_request_invoke_gl_tracker.Get().SetQueuedFunctorOnUi(this);
|
| + if (!client_->RequestInvokeGL(false)) {
|
| + g_request_invoke_gl_tracker.Get().ResetPending();
|
| LOG(ERROR) << "Failed to request GL process. Deadlock likely";
|
| }
|
| }
|
| @@ -262,7 +262,7 @@ void RenderThreadManager::DrawGL(AwDrawGLInfo* draw_info) {
|
| // corruption.
|
| if (draw_info->mode == AwDrawGLInfo::kModeProcess ||
|
| draw_info->mode == AwDrawGLInfo::kModeProcessNoContext) {
|
| - DidDrawGLProcess();
|
| + DidInvokeGLProcess();
|
| }
|
|
|
| {
|
| @@ -324,10 +324,10 @@ void RenderThreadManager::DeleteHardwareRendererOnUI() {
|
| client_->DetachFunctorFromView();
|
|
|
| // If the WebView gets onTrimMemory >= MODERATE twice in a row, the 2nd
|
| - // onTrimMemory will result in an unnecessary Render Thread DrawGL call.
|
| + // onTrimMemory will result in an unnecessary Render Thread InvokeGL call.
|
| bool hardware_initialized = HasFrameOnUI();
|
| if (hardware_initialized) {
|
| - bool draw_functor_succeeded = client_->RequestDrawGL(true);
|
| + bool draw_functor_succeeded = client_->RequestInvokeGL(true);
|
| if (!draw_functor_succeeded) {
|
| LOG(ERROR) << "Unable to free GL resources. Has the Window leaked?";
|
| // Calling release on wrong thread intentionally.
|
| @@ -349,7 +349,7 @@ void RenderThreadManager::DeleteHardwareRendererOnUI() {
|
|
|
| if (hardware_initialized) {
|
| // Flush any invoke functors that's caused by ReleaseHardware.
|
| - client_->RequestDrawGL(true);
|
| + client_->RequestInvokeGL(true);
|
| }
|
| }
|
|
|
|
|