Add ICU message format support
[chromium-blink-merge.git] / content / common / gpu / client / gpu_jpeg_decode_accelerator_host.h
blob8490801efd6bb2a8542b236487979bf15efdeefa
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.
5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
8 #include "base/memory/weak_ptr.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "media/video/jpeg_decode_accelerator.h"
12 namespace base {
13 class SingleThreadTaskRunner;
16 namespace IPC {
17 class Listener;
18 class Message;
21 namespace content {
22 class GpuChannelHost;
24 // This class is used to talk to JpegDecodeAccelerator in the GPU process
25 // through IPC messages.
26 class GpuJpegDecodeAcceleratorHost : public media::JpegDecodeAccelerator,
27 public base::NonThreadSafe {
28 public:
29 // VideoCaptureGpuJpegDecoder owns |this| and |channel|. And
30 // VideoCaptureGpuJpegDecoder delete |this| before |channel|. So |this| is
31 // guaranteed not to outlive |channel|.
32 GpuJpegDecodeAcceleratorHost(
33 GpuChannelHost* channel,
34 int32 route_id,
35 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
36 ~GpuJpegDecodeAcceleratorHost() override;
38 // media::JpegDecodeAccelerator implementation.
39 // |client| is called on the IO thread, but is never called into after the
40 // GpuJpegDecodeAcceleratorHost is destroyed.
41 bool Initialize(media::JpegDecodeAccelerator::Client* client) override;
42 void Decode(const media::BitstreamBuffer& bitstream_buffer,
43 const scoped_refptr<media::VideoFrame>& video_frame) override;
44 bool IsSupported() override;
46 base::WeakPtr<IPC::Listener> GetReceiver();
48 private:
49 class Receiver;
51 void Send(IPC::Message* message);
53 // Unowned reference to the GpuChannelHost to send IPC messages to the GPU
54 // process.
55 GpuChannelHost* channel_;
57 // Route ID for the associated decoder in the GPU process.
58 int32 decoder_route_id_;
60 // GPU IO task runner.
61 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
63 scoped_ptr<Receiver> receiver_;
65 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost);
68 } // namespace content
70 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_