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 MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ | |
6 #define MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/sequence_checker.h" | |
15 #include "media/video/jpeg_decode_accelerator.h" | |
16 | |
17 namespace base { | |
18 class SingleThreadTaskRunner; | |
19 } | |
20 | |
21 namespace gpu { | |
22 class GpuChannelHost; | |
23 } | |
24 | |
25 namespace IPC { | |
26 class Listener; | |
27 class Message; | |
28 } | |
29 | |
30 namespace media { | |
31 | |
32 // TODO(c.padhi): Move GpuJpegDecodeAcceleratorHost to media/gpu/mojo, see | |
33 // http://crbug.com/699255. | |
34 // This class is used to talk to JpegDecodeAccelerator in the GPU process | |
35 // through IPC messages. | |
36 class GpuJpegDecodeAcceleratorHost : public JpegDecodeAccelerator { | |
37 public: | |
38 GpuJpegDecodeAcceleratorHost( | |
39 scoped_refptr<gpu::GpuChannelHost> channel, | |
40 int32_t route_id, | |
41 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
42 ~GpuJpegDecodeAcceleratorHost() override; | |
43 | |
44 // JpegDecodeAccelerator implementation. | |
45 // |client| is called on the IO thread, but is never called into after the | |
46 // GpuJpegDecodeAcceleratorHost is destroyed. | |
47 bool Initialize(JpegDecodeAccelerator::Client* client) override; | |
48 void Decode(const BitstreamBuffer& bitstream_buffer, | |
49 const scoped_refptr<VideoFrame>& video_frame) override; | |
50 bool IsSupported() override; | |
51 | |
52 base::WeakPtr<IPC::Listener> GetReceiver(); | |
53 | |
54 private: | |
55 class Receiver; | |
56 | |
57 void Send(IPC::Message* message); | |
58 | |
59 scoped_refptr<gpu::GpuChannelHost> channel_; | |
60 | |
61 // Route ID for the associated decoder in the GPU process. | |
62 int32_t decoder_route_id_; | |
63 | |
64 // GPU IO task runner. | |
65 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
66 | |
67 std::unique_ptr<Receiver> receiver_; | |
68 | |
69 SEQUENCE_CHECKER(sequence_checker_); | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost); | |
72 }; | |
73 | |
74 } // namespace media | |
75 | |
76 #endif // MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ | |
OLD | NEW |