Chromium Code Reviews| Index: content/renderer/media/renderer_gpu_video_decoder_factories.cc |
| diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.cc b/content/renderer/media/renderer_gpu_video_decoder_factories.cc |
| index e79834db313b05b15aa0e92aa42103d16cbc9e11..aad30e95c3ccf60200a5c6161522ac83efbfcba6 100644 |
| --- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc |
| +++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc |
| @@ -9,15 +9,16 @@ |
| #include "content/common/child_thread.h" |
| #include "content/common/gpu/client/command_buffer_proxy.h" |
| #include "content/common/gpu/client/gpu_channel_host.h" |
| -#include "content/common/gpu/client/content_gl_context.h" |
| +#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| #include "gpu/command_buffer/client/gles2_implementation.h" |
| RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {} |
| RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories( |
| - GpuChannelHost* gpu_channel_host, base::WeakPtr<ContentGLContext> context) |
| - : message_loop_(MessageLoop::current()), |
| + GpuChannelHost* gpu_channel_host, MessageLoop* message_loop, |
| + WebGraphicsContext3DCommandBufferImpl* wgc3dcbi) |
| + : message_loop_(message_loop), |
| gpu_channel_host_(gpu_channel_host), |
| - context_(context) { |
| + wgc3dcbi_(wgc3dcbi) { |
| } |
| media::VideoDecodeAccelerator* |
| @@ -38,9 +39,10 @@ void RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator( |
| media::VideoDecodeAccelerator::Client* client, |
| media::VideoDecodeAccelerator** vda, |
| base::WaitableEvent* waiter) { |
| - if (context_) { |
| + if (wgc3dcbi_->makeContextCurrent()) { |
|
jamesr
2012/03/08 05:34:06
in chromium land is it typical practice to DCHECK(
Ami GONE FROM CHROMIUM
2012/03/08 17:39:50
Done.
|
| *vda = gpu_channel_host_->CreateVideoDecoder( |
| - context_->GetCommandBufferProxy()->route_id(), profile, client); |
| + wgc3dcbi_->context()->GetCommandBufferProxy()->route_id(), |
| + profile, client); |
| } else { |
| *vda = NULL; |
| } |
| @@ -63,12 +65,13 @@ bool RendererGpuVideoDecoderFactories::CreateTextures( |
| void RendererGpuVideoDecoderFactories::AsyncCreateTextures( |
| int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids, |
| uint32* texture_target, bool* success, base::WaitableEvent* waiter) { |
| - if (!context_) { |
| + if (!wgc3dcbi_->makeContextCurrent()) { |
| *success = false; |
| waiter->Signal(); |
| return; |
| } |
| - gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); |
| + gpu::gles2::GLES2Implementation* gles2 = |
| + wgc3dcbi_->context()->GetImplementation(); |
| texture_ids->resize(count); |
| gles2->GenTextures(count, &texture_ids->at(0)); |
| *texture_target = GL_TEXTURE_2D; |
| @@ -99,9 +102,10 @@ void RendererGpuVideoDecoderFactories::DeleteTexture(uint32 texture_id) { |
| void RendererGpuVideoDecoderFactories::AsyncDeleteTexture(uint32 texture_id) { |
| DCHECK_EQ(MessageLoop::current(), message_loop_); |
| - if (!context_) |
| + if (!wgc3dcbi_->makeContextCurrent()) |
| return; |
| - gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation(); |
| + gpu::gles2::GLES2Implementation* gles2 = |
| + wgc3dcbi_->context()->GetImplementation(); |
| gles2->DeleteTextures(1, &texture_id); |
| DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR)); |
| } |
| @@ -110,7 +114,7 @@ base::SharedMemory* RendererGpuVideoDecoderFactories::CreateSharedMemory( |
| size_t size) { |
| base::SharedMemory* shm = NULL; |
| base::WaitableEvent waiter(false, false); |
| - message_loop_->PostTask(FROM_HERE, base::Bind( |
| + ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind( |
| &RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory, this, |
| size, &shm, &waiter)); |
| waiter.Wait(); |