OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/gpu/media/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 make_context_current_ = | 72 make_context_current_ = |
73 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); | 73 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); |
74 } | 74 } |
75 | 75 |
76 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { | 76 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { |
77 if (stub_) { | 77 if (stub_) { |
78 stub_->channel()->RemoveRoute(host_route_id_); | 78 stub_->channel()->RemoveRoute(host_route_id_); |
79 stub_->RemoveDestructionObserver(this); | 79 stub_->RemoveDestructionObserver(this); |
80 } | 80 } |
81 | 81 |
82 if (video_decode_accelerator_.get()) | 82 if (video_decode_accelerator_) |
83 video_decode_accelerator_.release()->Destroy(); | 83 video_decode_accelerator_.release()->Destroy(); |
84 } | 84 } |
85 | 85 |
86 bool GpuVideoDecodeAccelerator::OnMessageReceived(const IPC::Message& msg) { | 86 bool GpuVideoDecodeAccelerator::OnMessageReceived(const IPC::Message& msg) { |
87 if (!stub_ || !video_decode_accelerator_.get()) | 87 if (!stub_ || !video_decode_accelerator_) |
88 return false; | 88 return false; |
89 bool handled = true; | 89 bool handled = true; |
90 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg) | 90 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg) |
91 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode) | 91 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode) |
92 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_AssignPictureBuffers, | 92 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_AssignPictureBuffers, |
93 OnAssignPictureBuffers) | 93 OnAssignPictureBuffers) |
94 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_ReusePictureBuffer, | 94 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_ReusePictureBuffer, |
95 OnReusePictureBuffer) | 95 OnReusePictureBuffer) |
96 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Flush, OnFlush) | 96 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Flush, OnFlush) |
97 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Reset, OnReset) | 97 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Reset, OnReset) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; | 342 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; |
343 } | 343 } |
344 | 344 |
345 void GpuVideoDecodeAccelerator::NotifyResetDone() { | 345 void GpuVideoDecodeAccelerator::NotifyResetDone() { |
346 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) | 346 if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_))) |
347 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; | 347 DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed"; |
348 } | 348 } |
349 | 349 |
350 void GpuVideoDecodeAccelerator::OnWillDestroyStub(GpuCommandBufferStub* stub) { | 350 void GpuVideoDecodeAccelerator::OnWillDestroyStub(GpuCommandBufferStub* stub) { |
351 DCHECK_EQ(stub, stub_.get()); | 351 DCHECK_EQ(stub, stub_.get()); |
352 if (video_decode_accelerator_.get()) | 352 if (video_decode_accelerator_) |
353 video_decode_accelerator_.release()->Destroy(); | 353 video_decode_accelerator_.release()->Destroy(); |
354 if (stub_) { | 354 if (stub_) { |
355 stub_->RemoveDestructionObserver(this); | 355 stub_->RemoveDestructionObserver(this); |
356 stub_.reset(); | 356 stub_.reset(); |
357 } | 357 } |
358 } | 358 } |
359 | 359 |
360 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 360 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
361 DCHECK(stub_); | 361 DCHECK(stub_); |
362 return stub_->channel()->Send(message); | 362 return stub_->channel()->Send(message); |
363 } | 363 } |
364 | 364 |
365 } // namespace content | 365 } // namespace content |
OLD | NEW |