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

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: rebaseforreals 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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/renderer_webkitplatformsupport_impl.h » ('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 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(
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/renderer_webkitplatformsupport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698