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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 12212100: Provide shared context to Platform API in renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index d9eaf1821ffd299526494982b863ca3751ceea3a..89bc95d6bc9c6dd01a384c10ec3d02c91ce2dbdf 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"
@@ -905,6 +906,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(

Powered by Google App Engine
This is Rietveld 408576698