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