Index: 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 1e824382eabebb9d079a6f43cd7596c8a61e0956..ffc91ea64767093c3f448cca631ee1b775e64fa8 100644 |
--- a/android_webview/browser/shared_renderer_state.cc |
+++ b/android_webview/browser/shared_renderer_state.cc |
@@ -20,7 +20,8 @@ SharedRendererState::SharedRendererState( |
: ui_loop_(ui_loop), |
client_on_ui_(client), |
weak_factory_on_ui_thread_(this), |
- ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()) { |
+ ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()), |
+ hardware_initialized_(false) { |
DCHECK(ui_loop_->BelongsToCurrentThread()); |
DCHECK(client_on_ui_); |
} |
@@ -40,7 +41,7 @@ void SharedRendererState::ClientRequestDrawGL() { |
void SharedRendererState::ClientRequestDrawGLOnUIThread() { |
DCHECK(ui_loop_->BelongsToCurrentThread()); |
- if (!client_on_ui_->RequestDrawGL(NULL)) { |
+ if (!client_on_ui_->RequestDrawGL(NULL, false)) { |
LOG(ERROR) << "Failed to request GL process. Deadlock likely"; |
} |
} |
@@ -68,4 +69,37 @@ DrawGLInput SharedRendererState::GetDrawGLInput() const { |
return draw_gl_input_; |
} |
+void SharedRendererState::ClearClosureQueue() { |
+ base::AutoLock lock(lock_); |
+ std::queue<base::Closure> empty; |
+ std::swap(closure_queue_, empty); |
+} |
+ |
+void SharedRendererState::AppendClosure(const base::Closure& closure) { |
+ 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; |
+} |
+ |
+void SharedRendererState::SetHardwareInitialized(bool initialized) { |
+ base::AutoLock lock(lock_); |
+ hardware_initialized_ = initialized; |
+} |
+ |
+bool SharedRendererState::IsHardwareInitialized() const { |
+ base::AutoLock lock(lock_); |
+ return hardware_initialized_; |
+} |
+ |
} // namespace android_webview |