Chromium Code Reviews| Index: content/common/gpu/media/gpu_jpeg_decode_accelerator.h |
| diff --git a/content/common/gpu/media/gpu_jpeg_decode_accelerator.h b/content/common/gpu/media/gpu_jpeg_decode_accelerator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..301a7b24515ec0a1c4944642f2cb4e5e5b7ebed5 |
| --- /dev/null |
| +++ b/content/common/gpu/media/gpu_jpeg_decode_accelerator.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/synchronization/waitable_event.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "ipc/ipc_listener.h" |
| +#include "ipc/ipc_sender.h" |
| +#include "media/video/jpeg_decode_accelerator.h" |
| + |
| +struct AcceleratedJpegDecoderMsg_Decode_Params; |
|
Pawel Osciak
2015/05/28 09:13:17
Is this needed here?
kcwu
2015/05/28 12:10:27
Done.
|
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace content { |
| +class GpuChannel; |
| + |
| +class GpuJpegDecodeAccelerator |
| + : public IPC::Listener, |
| + public IPC::Sender, |
| + public base::NonThreadSafe, |
| + public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { |
| + public: |
| + // |channel| must outlive this object. |
| + GpuJpegDecodeAccelerator( |
| + GpuChannel* channel, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| + ~GpuJpegDecodeAccelerator() override; |
| + |
| + void AddClient(int32 route_id, IPC::Message* reply_msg); |
| + |
| + // IPC::Listener implementation. |
| + bool OnMessageReceived(const IPC::Message& message) override; |
| + |
| + void NotifyDecodeStatus(int32 route_id, |
| + int32_t bitstream_buffer_id, |
| + media::JpegDecodeAccelerator::Error error); |
| + |
| + // Function to delegate sending to actual sender. |
| + bool Send(IPC::Message* message) override; |
| + |
| + private: |
| + class Client; |
| + class MessageFilter; |
| + |
| + void ClientRemoved(); |
| + |
| + // The lifetime of objects of this class is managed by a GpuChannel. The |
| + // GpuChannels destroy all the GpuJpegDecodeAccelerator that they own when |
| + // they are destroyed. So a raw pointer is safe. |
| + GpuChannel* channel_; |
| + |
| + // The message filter to run JpegDecodeAccelerator::Decode on IO thread. |
| + scoped_refptr<MessageFilter> filter_; |
| + |
| + // GPU child task runner. |
| + scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; |
| + |
| + // GPU IO task runner. |
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| + |
| + int client_number_; |
|
Pawel Osciak
2015/05/28 09:13:17
Please document.
kcwu
2015/05/28 12:10:27
Done.
|
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_GPU_JPEG_DECODE_ACCELERATOR_H_ |