| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" | 5 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "content/child/child_thread.h" | 11 #include "content/child/child_thread_impl.h" |
| 12 #include "content/common/gpu/client/context_provider_command_buffer.h" | 12 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 13 #include "content/common/gpu/client/gl_helper.h" | 13 #include "content/common/gpu/client/gl_helper.h" |
| 14 #include "content/common/gpu/client/gpu_channel_host.h" | 14 #include "content/common/gpu/client/gpu_channel_host.h" |
| 15 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" | 15 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" |
| 16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 17 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
| 18 #include "gpu/command_buffer/client/gles2_implementation.h" | 18 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 19 #include "media/video/video_decode_accelerator.h" | 19 #include "media/video/video_decode_accelerator.h" |
| 20 #include "media/video/video_encode_accelerator.h" | 20 #include "media/video/video_encode_accelerator.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 return factories; | 41 return factories; |
| 42 } | 42 } |
| 43 | 43 |
| 44 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories( | 44 RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories( |
| 45 GpuChannelHost* gpu_channel_host, | 45 GpuChannelHost* gpu_channel_host, |
| 46 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 46 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 47 const scoped_refptr<ContextProviderCommandBuffer>& context_provider) | 47 const scoped_refptr<ContextProviderCommandBuffer>& context_provider) |
| 48 : task_runner_(task_runner), | 48 : task_runner_(task_runner), |
| 49 gpu_channel_host_(gpu_channel_host), | 49 gpu_channel_host_(gpu_channel_host), |
| 50 context_provider_(context_provider), | 50 context_provider_(context_provider), |
| 51 thread_safe_sender_(ChildThread::current()->thread_safe_sender()) {} | 51 thread_safe_sender_(ChildThreadImpl::current()->thread_safe_sender()) {} |
| 52 | 52 |
| 53 RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {} | 53 RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {} |
| 54 | 54 |
| 55 void RendererGpuVideoAcceleratorFactories::BindContext() { | 55 void RendererGpuVideoAcceleratorFactories::BindContext() { |
| 56 DCHECK(task_runner_->BelongsToCurrentThread()); | 56 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 57 if (!context_provider_->BindToCurrentThread()) | 57 if (!context_provider_->BindToCurrentThread()) |
| 58 context_provider_ = NULL; | 58 context_provider_ = NULL; |
| 59 } | 59 } |
| 60 | 60 |
| 61 WebGraphicsContext3DCommandBufferImpl* | 61 WebGraphicsContext3DCommandBufferImpl* |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 NOTREACHED(); | 232 NOTREACHED(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 gl_helper->DeleteTexture(tmp_texture); | 235 gl_helper->DeleteTexture(tmp_texture); |
| 236 } | 236 } |
| 237 | 237 |
| 238 scoped_ptr<base::SharedMemory> | 238 scoped_ptr<base::SharedMemory> |
| 239 RendererGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) { | 239 RendererGpuVideoAcceleratorFactories::CreateSharedMemory(size_t size) { |
| 240 DCHECK(task_runner_->BelongsToCurrentThread()); | 240 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 241 scoped_ptr<base::SharedMemory> mem( | 241 scoped_ptr<base::SharedMemory> mem( |
| 242 ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get())); | 242 ChildThreadImpl::AllocateSharedMemory(size, thread_safe_sender_.get())); |
| 243 if (mem && !mem->Map(size)) | 243 if (mem && !mem->Map(size)) |
| 244 return nullptr; | 244 return nullptr; |
| 245 return mem; | 245 return mem; |
| 246 } | 246 } |
| 247 | 247 |
| 248 scoped_refptr<base::SingleThreadTaskRunner> | 248 scoped_refptr<base::SingleThreadTaskRunner> |
| 249 RendererGpuVideoAcceleratorFactories::GetTaskRunner() { | 249 RendererGpuVideoAcceleratorFactories::GetTaskRunner() { |
| 250 return task_runner_; | 250 return task_runner_; |
| 251 } | 251 } |
| 252 | 252 |
| 253 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 253 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 254 RendererGpuVideoAcceleratorFactories:: | 254 RendererGpuVideoAcceleratorFactories:: |
| 255 GetVideoEncodeAcceleratorSupportedProfiles() { | 255 GetVideoEncodeAcceleratorSupportedProfiles() { |
| 256 return GpuVideoEncodeAcceleratorHost::ConvertGpuToMediaProfiles( | 256 return GpuVideoEncodeAcceleratorHost::ConvertGpuToMediaProfiles( |
| 257 gpu_channel_host_->gpu_info() | 257 gpu_channel_host_->gpu_info() |
| 258 .video_encode_accelerator_supported_profiles); | 258 .video_encode_accelerator_supported_profiles); |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace content | 261 } // namespace content |
| OLD | NEW |