Index: content/renderer/render_thread_impl.cc |
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
index e23fa3fe212d610a51a7b5025675463c975e38d7..073796f7ac39d51ee3deddfde0464284cb4aa268 100644 |
--- a/content/renderer/render_thread_impl.cc |
+++ b/content/renderer/render_thread_impl.cc |
@@ -843,6 +843,7 @@ void RenderThreadImpl::Shutdown() { |
main_thread_compositor_task_runner_ = NULL; |
// Context providers must be released prior to destroying the GPU channel. |
+ shared_worker_context_provider_ = nullptr; |
gpu_va_context_provider_ = nullptr; |
shared_main_thread_contexts_ = nullptr; |
@@ -1337,7 +1338,7 @@ RenderThreadImpl::GetGpuFactories() { |
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = |
GetMediaThreadTaskRunner(); |
if (!gpu_va_context_provider_.get() || |
- gpu_va_context_provider_->DestroyedOnMainThread()) { |
+ gpu_va_context_provider_->HasBeenLostOnMainThread()) { |
if (!gpu_channel_host.get()) { |
gpu_channel_host = EstablishGpuChannelSync( |
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); |
@@ -1399,7 +1400,7 @@ scoped_refptr<cc_blink::ContextProviderWebContext> |
RenderThreadImpl::SharedMainThreadContextProvider() { |
DCHECK(IsMainThread()); |
if (!shared_main_thread_contexts_.get() || |
- shared_main_thread_contexts_->DestroyedOnMainThread()) { |
+ shared_main_thread_contexts_->HasBeenLostOnMainThread()) { |
shared_main_thread_contexts_ = NULL; |
#if defined(OS_ANDROID) |
SynchronousCompositorFactory* factory = |
@@ -1882,6 +1883,30 @@ base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { |
return raster_worker_pool_.get(); |
} |
+scoped_refptr<ContextProviderCommandBuffer> |
+RenderThreadImpl::SharedWorkerContextProvider() { |
+ DCHECK(IsMainThread()); |
+ // Try to reuse existing shared worker context provider. |
+ if (shared_worker_context_provider_) { |
+ base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
+ if (shared_worker_context_provider_->ContextGL() |
+ ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
+ shared_worker_context_provider_->Destroy(); |
+ shared_worker_context_provider_ = nullptr; |
+ } |
+ } |
+ if (!shared_worker_context_provider_) { |
+ shared_worker_context_provider_ = ContextProviderCommandBuffer::Create( |
+ CreateOffscreenContext3d(), RENDER_WORKER_CONTEXT); |
+ if (shared_worker_context_provider_ && |
+ !shared_worker_context_provider_->BindToCurrentThread()) |
+ shared_worker_context_provider_ = nullptr; |
+ if (shared_worker_context_provider_) |
+ shared_worker_context_provider_->SetupLock(); |
+ } |
+ return shared_worker_context_provider_; |
+} |
+ |
void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
blink_platform_impl_->sampleGamepads(*data); |
} |