Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1317743002: cc: Implement shared worker contexts. (v1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dtor fix Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 47371369dcb397885bf54f69dbdb24ae27e2b1cc..bcfb95768d4132ab576fd1879451395b641e56ea 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -843,6 +843,11 @@ void RenderThreadImpl::Shutdown() {
main_thread_compositor_task_runner_ = NULL;
// Context providers must be released prior to destroying the GPU channel.
+ if (shared_worker_context_provider_) {
+ base::AutoLock lock(*shared_worker_context_provider_->GetLock());
+ shared_worker_context_provider_->Destroy();
+ shared_worker_context_provider_ = nullptr;
+ }
gpu_va_context_provider_ = nullptr;
shared_main_thread_contexts_ = nullptr;
@@ -1882,6 +1887,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);
}
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698