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