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 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ |
6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 24 matching lines...) Expand all Loading... |
35 // |channel| must outlive this object. | 35 // |channel| must outlive this object. |
36 GpuJpegDecodeAccelerator( | 36 GpuJpegDecodeAccelerator( |
37 gpu::GpuChannel* channel, | 37 gpu::GpuChannel* channel, |
38 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 38 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
39 ~GpuJpegDecodeAccelerator() override; | 39 ~GpuJpegDecodeAccelerator() override; |
40 | 40 |
41 void AddClient(int32_t route_id, base::Callback<void(bool)> response); | 41 void AddClient(int32_t route_id, base::Callback<void(bool)> response); |
42 | 42 |
43 void NotifyDecodeStatus(int32_t route_id, | 43 void NotifyDecodeStatus(int32_t route_id, |
44 int32_t bitstream_buffer_id, | 44 int32_t bitstream_buffer_id, |
45 media::JpegDecodeAccelerator::Error error); | 45 JpegDecodeAccelerator::Error error); |
46 | 46 |
47 // Function to delegate sending to actual sender. | 47 // Function to delegate sending to actual sender. |
48 bool Send(IPC::Message* message) override; | 48 bool Send(IPC::Message* message) override; |
49 | 49 |
50 // Static query for JPEG supported. This query calls the appropriate | 50 // Static query for JPEG supported. This query calls the appropriate |
51 // platform-specific version. | 51 // platform-specific version. |
52 static bool IsSupported(); | 52 static bool IsSupported(); |
53 | 53 |
54 private: | 54 private: |
55 using CreateJDAFp = std::unique_ptr<media::JpegDecodeAccelerator> (*)( | 55 using CreateJDAFp = std::unique_ptr<JpegDecodeAccelerator> (*)( |
56 const scoped_refptr<base::SingleThreadTaskRunner>&); | 56 const scoped_refptr<base::SingleThreadTaskRunner>&); |
57 | 57 |
58 class Client; | 58 class Client; |
59 class MessageFilter; | 59 class MessageFilter; |
60 | 60 |
61 void ClientRemoved(); | 61 void ClientRemoved(); |
62 | 62 |
63 static std::unique_ptr<media::JpegDecodeAccelerator> CreateV4L2JDA( | 63 static std::unique_ptr<JpegDecodeAccelerator> CreateV4L2JDA( |
64 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 64 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
65 static std::unique_ptr<media::JpegDecodeAccelerator> CreateVaapiJDA( | 65 static std::unique_ptr<JpegDecodeAccelerator> CreateVaapiJDA( |
66 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 66 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
67 | 67 |
68 // The lifetime of objects of this class is managed by a gpu::GpuChannel. The | 68 // The lifetime of objects of this class is managed by a gpu::GpuChannel. The |
69 // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when | 69 // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when |
70 // they are destroyed. So a raw pointer is safe. | 70 // they are destroyed. So a raw pointer is safe. |
71 gpu::GpuChannel* channel_; | 71 gpu::GpuChannel* channel_; |
72 | 72 |
73 // The message filter to run JpegDecodeAccelerator::Decode on IO thread. | 73 // The message filter to run JpegDecodeAccelerator::Decode on IO thread. |
74 scoped_refptr<MessageFilter> filter_; | 74 scoped_refptr<MessageFilter> filter_; |
75 | 75 |
76 // GPU child task runner. | 76 // GPU child task runner. |
77 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; | 77 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; |
78 | 78 |
79 // GPU IO task runner. | 79 // GPU IO task runner. |
80 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 80 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
81 | 81 |
82 // Number of clients added to |filter_|. | 82 // Number of clients added to |filter_|. |
83 int client_number_; | 83 int client_number_; |
84 | 84 |
85 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); | 85 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace media | 88 } // namespace media |
89 | 89 |
90 #endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ | 90 #endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ |
OLD | NEW |