OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/client/gpu_jpeg_decode_accelerator_host.h" | 5 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/shared_memory_handle.h" | 12 #include "base/memory/shared_memory_handle.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/common/gpu/client/gpu_channel_host.h" | |
17 #include "content/common/gpu/media/media_messages.h" | 16 #include "content/common/gpu/media/media_messages.h" |
| 17 #include "gpu/ipc/client/gpu_channel_host.h" |
18 #include "ipc/ipc_listener.h" | 18 #include "ipc/ipc_listener.h" |
19 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
20 #include "ipc/ipc_message_utils.h" | 20 #include "ipc/ipc_message_utils.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 // Class to receive AcceleratedJpegDecoderHostMsg_DecodeAck IPC message on IO | 24 // Class to receive AcceleratedJpegDecoderHostMsg_DecodeAck IPC message on IO |
25 // thread. This does very similar what MessageFilter usually does. It is not | 25 // thread. This does very similar what MessageFilter usually does. It is not |
26 // MessageFilter because GpuChannelHost doesn't support AddFilter. | 26 // MessageFilter because GpuChannelHost doesn't support AddFilter. |
27 class GpuJpegDecodeAcceleratorHost::Receiver : public IPC::Listener, | 27 class GpuJpegDecodeAcceleratorHost::Receiver : public IPC::Listener, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // GPU IO task runner. | 90 // GPU IO task runner. |
91 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
92 | 92 |
93 // Weak pointers will be invalidated on IO thread. | 93 // Weak pointers will be invalidated on IO thread. |
94 base::WeakPtrFactory<Receiver> weak_factory_for_io_; | 94 base::WeakPtrFactory<Receiver> weak_factory_for_io_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(Receiver); | 96 DISALLOW_COPY_AND_ASSIGN(Receiver); |
97 }; | 97 }; |
98 | 98 |
99 GpuJpegDecodeAcceleratorHost::GpuJpegDecodeAcceleratorHost( | 99 GpuJpegDecodeAcceleratorHost::GpuJpegDecodeAcceleratorHost( |
100 GpuChannelHost* channel, | 100 gpu::GpuChannelHost* channel, |
101 int32_t route_id, | 101 int32_t route_id, |
102 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) | 102 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
103 : channel_(channel), | 103 : channel_(channel), |
104 decoder_route_id_(route_id), | 104 decoder_route_id_(route_id), |
105 io_task_runner_(io_task_runner) { | 105 io_task_runner_(io_task_runner) { |
106 DCHECK(channel_); | 106 DCHECK(channel_); |
107 DCHECK_NE(decoder_route_id_, MSG_ROUTING_NONE); | 107 DCHECK_NE(decoder_route_id_, MSG_ROUTING_NONE); |
108 } | 108 } |
109 | 109 |
110 GpuJpegDecodeAcceleratorHost::~GpuJpegDecodeAcceleratorHost() { | 110 GpuJpegDecodeAcceleratorHost::~GpuJpegDecodeAcceleratorHost() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (!channel_->Send(message)) { | 195 if (!channel_->Send(message)) { |
196 DLOG(ERROR) << "Send(" << message->type() << ") failed"; | 196 DLOG(ERROR) << "Send(" << message->type() << ") failed"; |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { | 200 base::WeakPtr<IPC::Listener> GpuJpegDecodeAcceleratorHost::GetReceiver() { |
201 return receiver_->AsWeakPtrForIO(); | 201 return receiver_->AsWeakPtrForIO(); |
202 } | 202 } |
203 | 203 |
204 } // namespace content | 204 } // namespace content |
OLD | NEW |