Index: content/renderer/media/renderer_gpu_video_accelerator_factories.cc |
diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc |
index 0a75c4660865f0060c8e4b8ab5936dd44c564c80..e7efe2904e28171b8f0cee2cb82a3daedec625dc 100644 |
--- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc |
+++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc |
@@ -8,6 +8,7 @@ |
#include <GLES2/gl2ext.h> |
#include "base/bind.h" |
+#include "content/child/child_gpu_memory_buffer_manager.h" |
#include "content/child/child_thread_impl.h" |
#include "content/common/gpu/client/context_provider_command_buffer.h" |
#include "content/common/gpu/client/gl_helper.h" |
@@ -16,6 +17,7 @@ |
#include "content/common/gpu/media/gpu_video_accelerator_util.h" |
#include "content/renderer/render_thread_impl.h" |
#include "gpu/command_buffer/client/gles2_implementation.h" |
+#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
#include "media/video/video_decode_accelerator.h" |
#include "media/video/video_encode_accelerator.h" |
@@ -46,7 +48,10 @@ RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories( |
: task_runner_(task_runner), |
gpu_channel_host_(gpu_channel_host), |
context_provider_(context_provider), |
- thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} |
+ gpu_memory_buffer_manager_( |
+ ChildThreadImpl::current()->gpu_memory_buffer_manager()), |
+ thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) { |
+} |
RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {} |
@@ -185,6 +190,37 @@ void RendererGpuVideoAcceleratorFactories::WaitSyncPoint(uint32 sync_point) { |
gles2->ShallowFlushCHROMIUM(); |
} |
+scoped_ptr<gfx::GpuMemoryBuffer> |
+RendererGpuVideoAcceleratorFactories::AllocateGpuMemoryBuffer( |
+ const gfx::Size& size, |
+ gfx::GpuMemoryBuffer::Format format, |
+ gfx::GpuMemoryBuffer::Usage usage) { |
+ DCHECK(task_runner_->BelongsToCurrentThread()); |
+ scoped_ptr<gfx::GpuMemoryBuffer> buffer = |
+ gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(size, format, usage); |
+ return buffer.Pass(); |
+} |
+ |
+bool RendererGpuVideoAcceleratorFactories::IsTextureRGSupported() { |
+ DCHECK(task_runner_->BelongsToCurrentThread()); |
+ |
+ WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
+ if (!context) |
+ return false; |
+ return context->GetImplementation()->capabilities().texture_rg; |
+} |
+ |
+gpu::gles2::GLES2Interface* |
+RendererGpuVideoAcceleratorFactories::GetGLES2Interface() { |
+ DCHECK(task_runner_->BelongsToCurrentThread()); |
+ |
+ WebGraphicsContext3DCommandBufferImpl* context = GetContext3d(); |
+ if (!context) |
+ return nullptr; |
+ gpu::gles2::GLES2Implementation* gles2 = context->GetImplementation(); |
+ return gles2; |
+} |
+ |
scoped_ptr<base::SharedMemory> |
RendererGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) { |
DCHECK(task_runner_->BelongsToCurrentThread()); |