Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h

Issue 2905823002: Add Mojo interfaces for GpuJpegDecodeAccelerator and GpuJpegDecodeAcceleratorHost (Closed)
Patch Set: mojo interface Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ 5 #ifndef MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
6 #define MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ 6 #define MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/thread_checker.h"
15 #include "media/gpu/mojo/jpeg_decoder.mojom.h"
15 #include "media/video/jpeg_decode_accelerator.h" 16 #include "media/video/jpeg_decode_accelerator.h"
16 17
17 namespace base { 18 namespace base {
18 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
19 } 20 }
20 21
21 namespace gpu { 22 namespace gpu {
22 class GpuChannelHost; 23 class GpuChannelHost;
23 } 24 }
24 25
25 namespace IPC { 26 namespace IPC {
26 class Listener; 27 class Listener;
27 class Message; 28 class Message;
28 } 29 }
29 30
30 namespace media { 31 namespace media {
31 32
32 // This class is used to talk to JpegDecodeAccelerator in the GPU process 33 // This class is used to talk to JpegDecodeAccelerator in the GPU process
33 // through IPC messages. 34 // through IPC messages.
34 class GpuJpegDecodeAcceleratorHost : public JpegDecodeAccelerator, 35 class GpuJpegDecodeAcceleratorHost
35 public base::NonThreadSafe { 36 : public JpegDecodeAccelerator,
37 public mojom::GpuJpegDecodeAcceleratorClient {
36 public: 38 public:
37 GpuJpegDecodeAcceleratorHost( 39 GpuJpegDecodeAcceleratorHost(
38 scoped_refptr<gpu::GpuChannelHost> channel, 40 scoped_refptr<gpu::GpuChannelHost> channel,
39 int32_t route_id, 41 int32_t route_id,
40 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); 42 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
41 ~GpuJpegDecodeAcceleratorHost() override; 43 ~GpuJpegDecodeAcceleratorHost() override;
42 44
43 // JpegDecodeAccelerator implementation. 45 // JpegDecodeAccelerator implementation.
44 // |client| is called on the IO thread, but is never called into after the 46 // |client| is called on the IO thread, but is never called into after the
45 // GpuJpegDecodeAcceleratorHost is destroyed. 47 // GpuJpegDecodeAcceleratorHost is destroyed.
46 bool Initialize(JpegDecodeAccelerator::Client* client) override; 48 bool Initialize(JpegDecodeAccelerator::Client* client) override;
47 void Decode(const BitstreamBuffer& bitstream_buffer, 49 void Decode(const BitstreamBuffer& bitstream_buffer,
48 const scoped_refptr<VideoFrame>& video_frame) override; 50 const scoped_refptr<VideoFrame>& video_frame) override;
49 bool IsSupported() override; 51 bool IsSupported() override;
50 52
53 // mojom::GpuJpegDecodeAcceleratorClient implementation.
54 void OnDecodeAck(int32_t bitstream_buffer_id, mojom::Error error) override;
55
51 base::WeakPtr<IPC::Listener> GetReceiver(); 56 base::WeakPtr<IPC::Listener> GetReceiver();
52 57
53 private: 58 private:
54 class Receiver; 59 class Receiver;
55 60
56 void Send(IPC::Message* message); 61 void Send(IPC::Message* message);
57 62
58 scoped_refptr<gpu::GpuChannelHost> channel_; 63 scoped_refptr<gpu::GpuChannelHost> channel_;
59 64
60 // Route ID for the associated decoder in the GPU process. 65 // Route ID for the associated decoder in the GPU process.
61 int32_t decoder_route_id_; 66 int32_t decoder_route_id_;
62 67
63 // GPU IO task runner. 68 // GPU IO task runner.
64 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 69 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
65 70
66 std::unique_ptr<Receiver> receiver_; 71 std::unique_ptr<Receiver> receiver_;
67 72
73 THREAD_CHECKER(thread_checker_);
68 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost); 74 DISALLOW_COPY_AND_ASSIGN(GpuJpegDecodeAcceleratorHost);
69 }; 75 };
70 76
71 } // namespace media 77 } // namespace media
72 78
73 #endif // MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_ 79 #endif // MEDIA_GPU_IPC_CLIENT_GPU_JPEG_DECODE_ACCELERATOR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698