OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ | |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ | |
7 | |
8 #include "base/memory/weak_ptr.h" | |
9 #include "base/threading/non_thread_safe.h" | |
10 #include "media/video/jpeg_decode_accelerator.h" | |
11 | |
12 namespace base { | |
13 class SingleThreadTaskRunner; | |
14 } | |
15 | |
16 namespace IPC { | |
17 class Listener; | |
18 class Message; | |
19 } | |
20 | |
21 namespace content { | |
22 class GpuChannelHost; | |
23 | |
24 // This class is used to talk to JpegDecodeAccelerator in the GPU process | |
25 // through IPC messages. | |
26 class GpuJpegDecodeAcceleratorHost : public media::JpegDecodeAccelerator, | |
27 public base::NonThreadSafe { | |
28 public: | |
29 // GpuJpegDecoder owns |this| and |channel|. And GpuJpegDecoder delete |this| | |
30 // before |channel|. So |this| is guaranteed not to outlive |channel|. | |
31 GpuJpegDecodeAcceleratorHost( | |
32 GpuChannelHost* channel, | |
33 int32 route_id, | |
34 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
35 ~GpuJpegDecodeAcceleratorHost() override; | |
36 | |
37 // media::JpegDecodeAccelerator implementation. | |
38 bool Initialize(media::JpegDecodeAccelerator::Client* client) override; | |
piman
2015/06/08 21:22:17
nit: can you add a comment that the Client is call
kcwu
2015/06/09 08:34:42
Done.
| |
39 void Decode(const media::BitstreamBuffer& bitstream_buffer, | |
40 const scoped_refptr<media::VideoFrame>& video_frame) override; | |
41 | |
42 base::WeakPtr<IPC::Listener> GetReceiver(); | |
43 | |
44 private: | |
45 class Receiver; | |
46 | |
47 void Send(IPC::Message* message); | |
48 | |
49 // Unowned reference to the GpuChannelHost to send IPC messages to the GPU | |
50 // process. | |
51 GpuChannelHost* channel_; | |
52 | |
53 // Route ID for the associated decoder in the GPU process. | |
54 int32 decoder_route_id_; | |
55 | |
56 // GPU IO task runner. | |
57 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
58 | |
59 scoped_ptr<Receiver> receiver_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost); | |
62 }; | |
63 | |
64 } // namespace content | |
65 | |
66 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ | |
OLD | NEW |