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::Listener, | |
piman
2015/05/28 22:01:40
nit: you don't need this any more. Nothing calls O
kcwu
2015/05/29 11:11:25
Done.
| |
25 public IPC::Sender, | |
26 public base::NonThreadSafe, | |
27 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { | |
28 public: | |
29 // |channel| must outlive this object. | |
30 GpuJpegDecodeAccelerator( | |
31 GpuChannel* channel, | |
32 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
33 ~GpuJpegDecodeAccelerator() override; | |
34 | |
35 void AddClient(int32 route_id, IPC::Message* reply_msg); | |
36 | |
37 // IPC::Listener implementation. | |
38 bool OnMessageReceived(const IPC::Message& message) override; | |
39 | |
40 void NotifyDecodeStatus(int32 route_id, | |
41 int32_t bitstream_buffer_id, | |
42 media::JpegDecodeAccelerator::Error error); | |
43 | |
44 // Function to delegate sending to actual sender. | |
45 bool Send(IPC::Message* message) override; | |
46 | |
47 private: | |
48 class Client; | |
49 class MessageFilter; | |
50 | |
51 void ClientRemoved(); | |
52 | |
53 // The lifetime of objects of this class is managed by a GpuChannel. The | |
54 // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when | |
55 // they are destroyed. So a raw pointer is safe. | |
56 GpuChannel* channel_; | |
57 | |
58 // The message filter to run JpegDecodeAccelerator::Decode on IO thread. | |
59 scoped_refptr<MessageFilter> filter_; | |
60 | |
61 // GPU child task runner. | |
62 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; | |
63 | |
64 // GPU IO task runner. | |
65 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
66 | |
67 // Number of clients added to |filter_|. | |
68 int client_number_; | |
69 | |
70 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); | |
71 }; | |
72 | |
73 } // namespace content | |
74 | |
75 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ | |
OLD | NEW |