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 CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
17 #include "media/video/jpeg_decode_accelerator.h" | 17 #include "media/video/jpeg_decode_accelerator.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
21 } | 21 } |
22 | 22 |
| 23 namespace gpu { |
| 24 class GpuChannel; |
| 25 } |
| 26 |
23 namespace content { | 27 namespace content { |
24 class GpuChannel; | |
25 | |
26 class GpuJpegDecodeAccelerator | 28 class GpuJpegDecodeAccelerator |
27 : public IPC::Sender, | 29 : public IPC::Sender, |
28 public base::NonThreadSafe, | 30 public base::NonThreadSafe, |
29 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { | 31 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { |
30 public: | 32 public: |
31 // |channel| must outlive this object. | 33 // |channel| must outlive this object. |
32 GpuJpegDecodeAccelerator( | 34 GpuJpegDecodeAccelerator( |
33 GpuChannel* channel, | 35 gpu::GpuChannel* channel, |
34 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 36 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
35 ~GpuJpegDecodeAccelerator() override; | 37 ~GpuJpegDecodeAccelerator() override; |
36 | 38 |
37 void AddClient(int32_t route_id, base::Callback<void(bool)> response); | 39 void AddClient(int32_t route_id, base::Callback<void(bool)> response); |
38 | 40 |
39 void NotifyDecodeStatus(int32_t route_id, | 41 void NotifyDecodeStatus(int32_t route_id, |
40 int32_t bitstream_buffer_id, | 42 int32_t bitstream_buffer_id, |
41 media::JpegDecodeAccelerator::Error error); | 43 media::JpegDecodeAccelerator::Error error); |
42 | 44 |
43 // Function to delegate sending to actual sender. | 45 // Function to delegate sending to actual sender. |
(...skipping 10 matching lines...) Expand all Loading... |
54 class Client; | 56 class Client; |
55 class MessageFilter; | 57 class MessageFilter; |
56 | 58 |
57 void ClientRemoved(); | 59 void ClientRemoved(); |
58 | 60 |
59 static scoped_ptr<media::JpegDecodeAccelerator> CreateV4L2JDA( | 61 static scoped_ptr<media::JpegDecodeAccelerator> CreateV4L2JDA( |
60 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 62 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
61 static scoped_ptr<media::JpegDecodeAccelerator> CreateVaapiJDA( | 63 static scoped_ptr<media::JpegDecodeAccelerator> CreateVaapiJDA( |
62 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 64 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
63 | 65 |
64 // The lifetime of objects of this class is managed by a GpuChannel. The | 66 // The lifetime of objects of this class is managed by a gpu::GpuChannel. The |
65 // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when | 67 // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when |
66 // they are destroyed. So a raw pointer is safe. | 68 // they are destroyed. So a raw pointer is safe. |
67 GpuChannel* channel_; | 69 gpu::GpuChannel* channel_; |
68 | 70 |
69 // The message filter to run JpegDecodeAccelerator::Decode on IO thread. | 71 // The message filter to run JpegDecodeAccelerator::Decode on IO thread. |
70 scoped_refptr<MessageFilter> filter_; | 72 scoped_refptr<MessageFilter> filter_; |
71 | 73 |
72 // GPU child task runner. | 74 // GPU child task runner. |
73 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; | 75 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; |
74 | 76 |
75 // GPU IO task runner. | 77 // GPU IO task runner. |
76 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 78 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
77 | 79 |
78 // Number of clients added to |filter_|. | 80 // Number of clients added to |filter_|. |
79 int client_number_; | 81 int client_number_; |
80 | 82 |
81 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); |
82 }; | 84 }; |
83 | 85 |
84 } // namespace content | 86 } // namespace content |
85 | 87 |
86 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | 88 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ |
OLD | NEW |