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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(int32 host_route_id, | 57 GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(int32 host_route_id, |
58 GpuCommandBufferStub* stub) | 58 GpuCommandBufferStub* stub) |
59 : init_done_msg_(NULL), | 59 : init_done_msg_(NULL), |
60 host_route_id_(host_route_id), | 60 host_route_id_(host_route_id), |
61 stub_(stub), | 61 stub_(stub), |
62 texture_target_(0) { | 62 texture_target_(0) { |
63 DCHECK(stub_); | 63 DCHECK(stub_); |
64 stub_->AddDestructionObserver(this); | 64 stub_->AddDestructionObserver(this); |
65 stub_->channel()->AddRoute(host_route_id_, this); | 65 stub_->channel()->AddRoute(host_route_id_, this); |
| 66 stub_->channel()->AddMessageFilterRoute(host_route_id_, this); |
66 make_context_current_ = | 67 make_context_current_ = |
67 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); | 68 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); |
68 } | 69 } |
69 | 70 |
70 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { | 71 GpuVideoDecodeAccelerator::~GpuVideoDecodeAccelerator() { |
71 DCHECK(stub_); | 72 DCHECK(stub_); |
72 if (video_decode_accelerator_) | 73 if (video_decode_accelerator_) |
73 video_decode_accelerator_.release()->Destroy(); | 74 video_decode_accelerator_.release()->Destroy(); |
74 | 75 |
75 stub_->channel()->RemoveRoute(host_route_id_); | 76 stub_->channel()->RemoveRoute(host_route_id_); |
| 77 stub_->channel()->RemoveMessageFilterRoute(host_route_id_); |
76 stub_->RemoveDestructionObserver(this); | 78 stub_->RemoveDestructionObserver(this); |
77 } | 79 } |
78 | 80 |
79 bool GpuVideoDecodeAccelerator::OnMessageReceived(const IPC::Message& msg) { | 81 bool GpuVideoDecodeAccelerator::OnMessageReceived(const IPC::Message& msg) { |
80 DCHECK(stub_); | 82 DCHECK(stub_); |
81 if (!video_decode_accelerator_) | 83 if (!video_decode_accelerator_) |
82 return false; | 84 return false; |
83 bool handled = true; | 85 bool handled = true; |
84 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg) | 86 IPC_BEGIN_MESSAGE_MAP(GpuVideoDecodeAccelerator, msg) |
85 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode) | 87 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderMsg_Decode, OnDecode) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { | 333 void GpuVideoDecodeAccelerator::OnWillDestroyStub() { |
332 delete this; | 334 delete this; |
333 } | 335 } |
334 | 336 |
335 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 337 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
336 DCHECK(stub_); | 338 DCHECK(stub_); |
337 return stub_->channel()->Send(message); | 339 return stub_->channel()->Send(message); |
338 } | 340 } |
339 | 341 |
340 } // namespace content | 342 } // namespace content |
OLD | NEW |