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_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "ipc/ipc_listener.h" |
| 11 #include "media/video/jpeg_decode_accelerator.h" |
| 12 |
| 13 namespace content { |
| 14 class GpuChannelHost; |
| 15 |
| 16 // This class is used to talk to JpegDecodeAccelerator in the GPU process |
| 17 // through IPC messages. |
| 18 class GpuJpegDecodeAcceleratorHost |
| 19 : public IPC::Listener, |
| 20 public media::JpegDecodeAccelerator, |
| 21 public base::NonThreadSafe, |
| 22 public base::SupportsWeakPtr<GpuJpegDecodeAcceleratorHost> { |
| 23 public: |
| 24 // |this| is guaranteed not to outlive |channel|. (See comments for |
| 25 // |channel_|.) |
| 26 GpuJpegDecodeAcceleratorHost(GpuChannelHost* channel, int32 route_id); |
| 27 |
| 28 // IPC::Listener implementation. |
| 29 void OnChannelError() override; |
| 30 bool OnMessageReceived(const IPC::Message& message) override; |
| 31 |
| 32 // media::JpegDecodeAccelerator implementation. |
| 33 bool Initialize(media::JpegDecodeAccelerator::Client* client) override; |
| 34 void Decode(const media::BitstreamBuffer& bitstream_buffer, |
| 35 const scoped_refptr<media::VideoFrame>& video_frame) override; |
| 36 void Destroy() override; |
| 37 |
| 38 private: |
| 39 // Only Destroy() should be deleting |this|. |
| 40 ~GpuJpegDecodeAcceleratorHost() override; |
| 41 |
| 42 void Send(IPC::Message* message); |
| 43 |
| 44 void OnVideoFrameReady(int32_t bitstream_buffer_id); |
| 45 void OnNotifyError(int32_t bitstream_buffer_id, Error error); |
| 46 |
| 47 // Unowned reference to the GpuChannelHost to send IPC messages to the GPU |
| 48 // process. |channel_| is always valid as long as it is not NULL. |
| 49 GpuChannelHost* channel_; |
| 50 |
| 51 Client* client_; |
| 52 |
| 53 // Route ID for the associated decoder in the GPU process. |
| 54 int32 decoder_route_id_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost); |
| 57 }; |
| 58 |
| 59 } // namespace content |
| 60 |
| 61 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ |
OLD | NEW |