Chromium Code Reviews| Index: content/renderer/gpu/gpu_video_service_host.cc |
| diff --git a/content/renderer/gpu/gpu_video_service_host.cc b/content/renderer/gpu/gpu_video_service_host.cc |
| index 9b3fe2238dfa67c78fad784d6a963a84e50c5593..e2ba13e92b89425742284b4c3c9f8d1505079a8b 100644 |
| --- a/content/renderer/gpu/gpu_video_service_host.cc |
| +++ b/content/renderer/gpu/gpu_video_service_host.cc |
| @@ -12,32 +12,24 @@ |
| GpuVideoServiceHost::GpuVideoServiceHost() |
|
scherkus (not reviewing)
2011/06/28 22:02:07
nit: if the object is created/destroyed on same th
Ami GONE FROM CHROMIUM
2011/06/28 22:25:06
Done.
|
| : channel_(NULL), |
| next_decoder_host_id_(0) { |
| + DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current()); |
|
scherkus (not reviewing)
2011/06/28 22:02:07
ditto
Ami GONE FROM CHROMIUM
2011/06/28 22:25:06
Done.
|
| } |
| GpuVideoServiceHost::~GpuVideoServiceHost() { |
| } |
| -void GpuVideoServiceHost::OnFilterAdded(IPC::Channel* channel) { |
| - base::Closure on_initialized; |
| - { |
| - base::AutoLock auto_lock(lock_); |
| - DCHECK(!channel_); |
| - channel_ = channel; |
| - on_initialized = on_initialized_; |
| - } |
| - if (!on_initialized.is_null()) |
| - on_initialized.Run(); |
| -} |
| - |
| -void GpuVideoServiceHost::OnFilterRemoved() { |
| - // TODO(hclam): Implement. |
| -} |
| - |
| -void GpuVideoServiceHost::OnChannelClosing() { |
| - // TODO(hclam): Implement. |
| +void GpuVideoServiceHost::set_channel(IPC::SyncChannel* channel) { |
| + DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current()); |
| + DCHECK(!channel_); |
| + channel_ = channel; |
| + if (!on_initialized_.is_null()) |
| + on_initialized_.Run(); |
| } |
| bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) { |
| + DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current()); |
| + if (!channel_) |
| + return false; |
| switch (msg.type()) { |
| case AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed::ID: |
| case AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers::ID: |
| @@ -57,25 +49,27 @@ bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) { |
| } |
| } |
| +void GpuVideoServiceHost::OnChannelError() { |
| + DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current()); |
| + channel_ = NULL; |
| +} |
| + |
| void GpuVideoServiceHost::SetOnInitialized( |
| const base::Closure& on_initialized) { |
| - IPC::Channel* channel; |
| - { |
| - base::AutoLock auto_lock(lock_); |
| - DCHECK(on_initialized_.is_null()); |
| - on_initialized_ = on_initialized; |
| - channel = channel_; |
| - } |
| - if (channel) |
| + DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current()); |
| + DCHECK(on_initialized_.is_null()); |
| + on_initialized_ = on_initialized; |
| + if (channel_) |
| on_initialized.Run(); |
| } |
| GpuVideoDecodeAcceleratorHost* GpuVideoServiceHost::CreateVideoAccelerator( |
| media::VideoDecodeAccelerator::Client* client, |
| - int command_buffer_route_id) { |
| - base::AutoLock auto_lock(lock_); |
| + int32 command_buffer_route_id, |
| + gpu::CommandBufferHelper* cmd_buffer_helper) { |
| + DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current()); |
| DCHECK(channel_); |
| return new GpuVideoDecodeAcceleratorHost( |
| &router_, channel_, next_decoder_host_id_++, |
| - command_buffer_route_id, client); |
| + command_buffer_route_id, cmd_buffer_helper, client); |
| } |