Index: content/renderer/render_thread_impl.cc |
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
index 0f33ddde21965255aa1f75423ba5980b363fffd1..e129afbe184ac759e731a5f6938b50b8a9520891 100644 |
--- a/content/renderer/render_thread_impl.cc |
+++ b/content/renderer/render_thread_impl.cc |
@@ -30,6 +30,7 @@ |
#include "content/common/database_messages.h" |
#include "content/common/db_message_filter.h" |
#include "content/common/dom_storage_messages.h" |
+#include "content/common/gpu/client/context_provider_command_buffer.h" |
#include "content/common/gpu/client/gpu_channel_host.h" |
#include "content/common/gpu/gpu_messages.h" |
#include "content/common/indexed_db/indexed_db_dispatcher.h" |
@@ -906,6 +907,53 @@ RenderThreadImpl::GetGpuVDAContext3D() { |
return gpu_vda_context3d_.get(); |
} |
+scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
+RenderThreadImpl::CreateOffscreenContext3d() { |
+ WebKit::WebGraphicsContext3D::Attributes attributes; |
+ attributes.shareResources = true; |
+ attributes.depth = false; |
+ attributes.stencil = false; |
+ attributes.antialias = false; |
+ attributes.noAutomaticFlushes = true; |
+ |
+ return make_scoped_ptr( |
+ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
+ this, |
+ attributes, |
+ GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"))); |
+} |
+ |
+class RenderThreadImpl::RendererContextProviderCommandBuffer |
+ : public content::ContextProviderCommandBuffer { |
+ protected: |
+ virtual ~RendererContextProviderCommandBuffer() {} |
+ |
+ virtual scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
+ CreateOffscreenContext3d() { |
+ RenderThreadImpl* self = RenderThreadImpl::current(); |
+ DCHECK(self); |
+ return self->CreateOffscreenContext3d().Pass(); |
+ } |
+}; |
+ |
+scoped_refptr<cc::ContextProvider> |
+RenderThreadImpl::OffscreenContextProviderForMainThread() { |
+ if (!shared_contexts_main_thread_ || |
+ shared_contexts_main_thread_->DestroyedOnMainThread()) |
+ shared_contexts_main_thread_ = new RendererContextProviderCommandBuffer; |
+ return shared_contexts_main_thread_; |
+} |
+ |
+scoped_refptr<cc::ContextProvider> |
+RenderThreadImpl::OffscreenContextProviderForCompositorThread() { |
+ if (!shared_contexts_compositor_thread_ || |
+ shared_contexts_compositor_thread_->DestroyedOnMainThread()) { |
+ shared_contexts_compositor_thread_ = |
+ new RendererContextProviderCommandBuffer; |
+ } |
+ return shared_contexts_compositor_thread_; |
+} |
+ |
AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
if (!audio_renderer_mixer_manager_.get()) { |
audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( |