| 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 7d4db85513f3c1447328616aa04a3128628af391..442035263cbbcc452b94ae70d69fa420cb9a6042 100644
|
| --- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
|
| +++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
|
| @@ -22,40 +22,40 @@ RendererGpuVideoAcceleratorFactories::~RendererGpuVideoAcceleratorFactories() {}
|
| RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories(
|
| GpuChannelHost* gpu_channel_host,
|
| const scoped_refptr<ContextProviderCommandBuffer>& context_provider)
|
| - : message_loop_(
|
| + : task_runner_(
|
| RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy()),
|
| gpu_channel_host_(gpu_channel_host),
|
| context_provider_(context_provider),
|
| thread_safe_sender_(ChildThread::current()->thread_safe_sender()),
|
| aborted_waiter_(true, false),
|
| - message_loop_async_waiter_(false, false) {
|
| + task_runner_async_waiter_(false, false) {
|
| // |context_provider_| is only required to support HW-accelerated decode.
|
| if (!context_provider_)
|
| return;
|
|
|
| - if (message_loop_->BelongsToCurrentThread()) {
|
| + if (task_runner_->BelongsToCurrentThread()) {
|
| AsyncBindContext();
|
| - message_loop_async_waiter_.Reset();
|
| + task_runner_async_waiter_.Reset();
|
| return;
|
| }
|
| // Wait for the context to be acquired.
|
| - message_loop_->PostTask(
|
| + task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&RendererGpuVideoAcceleratorFactories::AsyncBindContext,
|
| // Unretained to avoid ref/deref'ing |*this|, which is not yet
|
| // stored in a scoped_refptr. Safe because the Wait() below
|
| // keeps us alive until this task completes.
|
| base::Unretained(this)));
|
| - message_loop_async_waiter_.Wait();
|
| + task_runner_async_waiter_.Wait();
|
| }
|
|
|
| RendererGpuVideoAcceleratorFactories::RendererGpuVideoAcceleratorFactories()
|
| : aborted_waiter_(true, false),
|
| - message_loop_async_waiter_(false, false) {}
|
| + task_runner_async_waiter_(false, false) {}
|
|
|
| WebGraphicsContext3DCommandBufferImpl*
|
| RendererGpuVideoAcceleratorFactories::GetContext3d() {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
| if (!context_provider_)
|
| return NULL;
|
| WebGraphicsContext3DCommandBufferImpl* context =
|
| @@ -69,24 +69,24 @@ RendererGpuVideoAcceleratorFactories::GetContext3d() {
|
| }
|
|
|
| void RendererGpuVideoAcceleratorFactories::AsyncBindContext() {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
| if (!context_provider_->BindToCurrentThread())
|
| context_provider_ = NULL;
|
| - message_loop_async_waiter_.Signal();
|
| + task_runner_async_waiter_.Signal();
|
| }
|
|
|
| scoped_ptr<media::VideoDecodeAccelerator>
|
| RendererGpuVideoAcceleratorFactories::CreateVideoDecodeAccelerator(
|
| media::VideoCodecProfile profile,
|
| media::VideoDecodeAccelerator::Client* client) {
|
| - if (message_loop_->BelongsToCurrentThread()) {
|
| + if (task_runner_->BelongsToCurrentThread()) {
|
| AsyncCreateVideoDecodeAccelerator(profile, client);
|
| - message_loop_async_waiter_.Reset();
|
| + task_runner_async_waiter_.Reset();
|
| return vda_.Pass();
|
| }
|
| // The VDA is returned in the vda_ member variable by the
|
| // AsyncCreateVideoDecodeAccelerator() function.
|
| - message_loop_->PostTask(FROM_HERE,
|
| + task_runner_->PostTask(FROM_HERE,
|
| base::Bind(&RendererGpuVideoAcceleratorFactories::
|
| AsyncCreateVideoDecodeAccelerator,
|
| this,
|
| @@ -94,12 +94,12 @@ RendererGpuVideoAcceleratorFactories::CreateVideoDecodeAccelerator(
|
| client));
|
|
|
| base::WaitableEvent* objects[] = {&aborted_waiter_,
|
| - &message_loop_async_waiter_};
|
| + &task_runner_async_waiter_};
|
| if (base::WaitableEvent::WaitMany(objects, arraysize(objects)) == 0) {
|
| // If we are aborting and the VDA is created by the
|
| // AsyncCreateVideoDecodeAccelerator() function later we need to ensure
|
| // that it is destroyed on the same thread.
|
| - message_loop_->PostTask(FROM_HERE,
|
| + task_runner_->PostTask(FROM_HERE,
|
| base::Bind(&RendererGpuVideoAcceleratorFactories::
|
| AsyncDestroyVideoDecodeAccelerator,
|
| this));
|
| @@ -111,7 +111,7 @@ RendererGpuVideoAcceleratorFactories::CreateVideoDecodeAccelerator(
|
| scoped_ptr<media::VideoEncodeAccelerator>
|
| RendererGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator(
|
| media::VideoEncodeAccelerator::Client* client) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
|
|
| return gpu_channel_host_->CreateVideoEncoder(client);
|
| }
|
| @@ -119,14 +119,14 @@ RendererGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator(
|
| void RendererGpuVideoAcceleratorFactories::AsyncCreateVideoDecodeAccelerator(
|
| media::VideoCodecProfile profile,
|
| media::VideoDecodeAccelerator::Client* client) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
|
|
| WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
|
| if (context && context->GetCommandBufferProxy()) {
|
| vda_ = gpu_channel_host_->CreateVideoDecoder(
|
| context->GetCommandBufferProxy()->GetRouteID(), profile, client);
|
| }
|
| - message_loop_async_waiter_.Signal();
|
| + task_runner_async_waiter_.Signal();
|
| }
|
|
|
| uint32 RendererGpuVideoAcceleratorFactories::CreateTextures(
|
| @@ -135,7 +135,7 @@ uint32 RendererGpuVideoAcceleratorFactories::CreateTextures(
|
| std::vector<uint32>* texture_ids,
|
| std::vector<gpu::Mailbox>* texture_mailboxes,
|
| uint32 texture_target) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
| DCHECK(texture_target);
|
|
|
| WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
|
| @@ -180,7 +180,7 @@ uint32 RendererGpuVideoAcceleratorFactories::CreateTextures(
|
| }
|
|
|
| void RendererGpuVideoAcceleratorFactories::DeleteTexture(uint32 texture_id) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
|
|
| WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
|
| if (!context)
|
| @@ -192,7 +192,7 @@ void RendererGpuVideoAcceleratorFactories::DeleteTexture(uint32 texture_id) {
|
| }
|
|
|
| void RendererGpuVideoAcceleratorFactories::WaitSyncPoint(uint32 sync_point) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
|
|
| WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
|
| if (!context)
|
| @@ -215,20 +215,20 @@ void RendererGpuVideoAcceleratorFactories::ReadPixels(uint32 texture_id,
|
| // until the AsyncReadPixels() call completes.
|
| read_pixels_bitmap_.setPixelRef(pixels.pixelRef());
|
|
|
| - if (!message_loop_->BelongsToCurrentThread()) {
|
| - message_loop_->PostTask(
|
| + if (!task_runner_->BelongsToCurrentThread()) {
|
| + task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&RendererGpuVideoAcceleratorFactories::AsyncReadPixels,
|
| this,
|
| texture_id,
|
| size));
|
| base::WaitableEvent* objects[] = {&aborted_waiter_,
|
| - &message_loop_async_waiter_};
|
| + &task_runner_async_waiter_};
|
| if (base::WaitableEvent::WaitMany(objects, arraysize(objects)) == 0)
|
| return;
|
| } else {
|
| AsyncReadPixels(texture_id, size);
|
| - message_loop_async_waiter_.Reset();
|
| + task_runner_async_waiter_.Reset();
|
| }
|
| read_pixels_bitmap_.setPixelRef(NULL);
|
| }
|
| @@ -236,10 +236,10 @@ void RendererGpuVideoAcceleratorFactories::ReadPixels(uint32 texture_id,
|
| void RendererGpuVideoAcceleratorFactories::AsyncReadPixels(
|
| uint32 texture_id,
|
| const gfx::Size& size) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
| WebGraphicsContext3DCommandBufferImpl* context = GetContext3d();
|
| if (!context) {
|
| - message_loop_async_waiter_.Signal();
|
| + task_runner_async_waiter_.Signal();
|
| return;
|
| }
|
|
|
| @@ -280,18 +280,18 @@ void RendererGpuVideoAcceleratorFactories::AsyncReadPixels(
|
| gles2->DeleteFramebuffers(1, &fb);
|
| gles2->DeleteTextures(1, &tmp_texture);
|
| DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
|
| - message_loop_async_waiter_.Signal();
|
| + task_runner_async_waiter_.Signal();
|
| }
|
|
|
| base::SharedMemory* RendererGpuVideoAcceleratorFactories::CreateSharedMemory(
|
| size_t size) {
|
| - DCHECK(message_loop_->BelongsToCurrentThread());
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
| return ChildThread::AllocateSharedMemory(size, thread_safe_sender_.get());
|
| }
|
|
|
| -scoped_refptr<base::MessageLoopProxy>
|
| -RendererGpuVideoAcceleratorFactories::GetMessageLoop() {
|
| - return message_loop_;
|
| +scoped_refptr<base::SingleThreadTaskRunner>
|
| +RendererGpuVideoAcceleratorFactories::GetTaskRunner() {
|
| + return task_runner_;
|
| }
|
|
|
| void RendererGpuVideoAcceleratorFactories::Abort() { aborted_waiter_.Signal(); }
|
| @@ -304,7 +304,7 @@ scoped_refptr<RendererGpuVideoAcceleratorFactories>
|
| RendererGpuVideoAcceleratorFactories::Clone() {
|
| scoped_refptr<RendererGpuVideoAcceleratorFactories> factories =
|
| new RendererGpuVideoAcceleratorFactories();
|
| - factories->message_loop_ = message_loop_;
|
| + factories->task_runner_ = task_runner_;
|
| factories->gpu_channel_host_ = gpu_channel_host_;
|
| factories->context_provider_ = context_provider_;
|
| factories->thread_safe_sender_ = thread_safe_sender_;
|
|
|