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_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "base/synchronization/waitable_event.h" | |
11 #include "base/threading/non_thread_safe.h" | |
12 #include "ipc/ipc_listener.h" | |
13 #include "ipc/ipc_sender.h" | |
14 #include "media/video/jpeg_decode_accelerator.h" | |
15 | |
16 namespace base { | |
17 class SingleThreadTaskRunner; | |
18 } | |
19 | |
20 namespace content { | |
21 class GpuChannel; | |
22 | |
23 class GpuJpegDecodeAccelerator | |
24 : public IPC::Sender, | |
25 public base::NonThreadSafe, | |
26 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { | |
27 public: | |
28 // |channel| must outlive this object. | |
29 GpuJpegDecodeAccelerator( | |
30 GpuChannel* channel, | |
31 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
32 ~GpuJpegDecodeAccelerator() override; | |
33 | |
34 void AddClient(int32 route_id, IPC::Message* reply_msg); | |
35 | |
36 void NotifyDecodeStatus(int32 route_id, | |
37 int32_t bitstream_buffer_id, | |
38 media::JpegDecodeAccelerator::Error error); | |
39 | |
40 // Function to delegate sending to actual sender. | |
41 bool Send(IPC::Message* message) override; | |
42 | |
43 private: | |
44 class Client; | |
45 class MessageFilter; | |
46 | |
47 void ClientRemoved(); | |
48 | |
49 // The lifetime of objects of this class is managed by a GpuChannel. The | |
50 // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when | |
palmer
2015/06/11 23:28:28
This comment feels a bit strange to me; as declare
wuchengli
2015/06/12 02:29:41
The comment is right. GpuChannel owns GpuJpegDecod
kcwu
2015/06/12 12:22:00
Yes, as wuchengli said, GpuChannel owns GpuJpegDec
| |
51 // they are destroyed. So a raw pointer is safe. | |
52 GpuChannel* channel_; | |
53 | |
54 // The message filter to run JpegDecodeAccelerator::Decode on IO thread. | |
55 scoped_refptr<MessageFilter> filter_; | |
56 | |
57 // GPU child task runner. | |
58 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; | |
59 | |
60 // GPU IO task runner. | |
61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
62 | |
63 // Number of clients added to |filter_|. | |
64 int client_number_; | |
65 | |
66 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); | |
67 }; | |
68 | |
69 } // namespace content | |
70 | |
71 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | |
OLD | NEW |