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

Side by Side Diff: media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h

Issue 2905823002: Add Mojo interfaces for GpuJpegDecodeAccelerator and GpuJpegDecodeAcceleratorHost (Closed)
Patch Set: rebase Created 3 years, 6 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
« no previous file with comments | « media/gpu/ipc/service/BUILD.gn ('k') | media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_
6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ 6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_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/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/sequence_checker.h" 15 #include "base/sequence_checker.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "ipc/ipc_listener.h" 17 #include "ipc/ipc_listener.h"
18 #include "ipc/ipc_sender.h" 18 #include "ipc/ipc_sender.h"
19 #include "media/gpu/mojo/jpeg_decoder.mojom.h"
19 #include "media/video/jpeg_decode_accelerator.h" 20 #include "media/video/jpeg_decode_accelerator.h"
20 21
21 namespace base { 22 namespace base {
22 class SingleThreadTaskRunner; 23 class SingleThreadTaskRunner;
23 } 24 }
24 25
25 namespace gpu { 26 namespace gpu {
26 class FilteredSender; 27 class FilteredSender;
27 } 28 }
28 29
29 namespace media { 30 namespace media {
30 31
31 class GpuJpegDecodeAcceleratorFactoryProvider { 32 class GpuJpegDecodeAcceleratorFactoryProvider {
32 public: 33 public:
33 using CreateAcceleratorCB = 34 using CreateAcceleratorCB =
34 base::Callback<std::unique_ptr<JpegDecodeAccelerator>( 35 base::Callback<std::unique_ptr<JpegDecodeAccelerator>(
35 scoped_refptr<base::SingleThreadTaskRunner>)>; 36 scoped_refptr<base::SingleThreadTaskRunner>)>;
36 37
37 // Static query for JPEG supported. This query calls the appropriate 38 // Static query for JPEG supported. This query calls the appropriate
38 // platform-specific version. 39 // platform-specific version.
39 static bool IsAcceleratedJpegDecodeSupported(); 40 static bool IsAcceleratedJpegDecodeSupported();
40 41
41 static std::vector<CreateAcceleratorCB> GetAcceleratorFactories(); 42 static std::vector<CreateAcceleratorCB> GetAcceleratorFactories();
42 }; 43 };
43 44
45 // TODO(c.padhi): Move GpuJpegDecodeAccelerator to media/gpu/mojo, see
46 // http://crbug.com/699255.
44 class GpuJpegDecodeAccelerator 47 class GpuJpegDecodeAccelerator
45 : public IPC::Sender, 48 : public IPC::Sender,
49 public mojom::GpuJpegDecodeAccelerator,
46 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { 50 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> {
47 public: 51 public:
48 // |channel| must outlive this object. 52 // |channel| must outlive this object.
49 // This convenience constructor internally calls 53 // This convenience constructor internally calls
50 // GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() to 54 // GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() to
51 // fill |accelerator_factory_functions_|. 55 // fill |accelerator_factory_functions_|.
52 GpuJpegDecodeAccelerator( 56 GpuJpegDecodeAccelerator(
53 gpu::FilteredSender* channel, 57 gpu::FilteredSender* channel,
54 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); 58 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
55 59
56 // |channel| must outlive this object. 60 // |channel| must outlive this object.
57 GpuJpegDecodeAccelerator( 61 GpuJpegDecodeAccelerator(
58 gpu::FilteredSender* channel, 62 gpu::FilteredSender* channel,
59 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
60 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> 64 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB>
61 accelerator_factory_functions); 65 accelerator_factory_functions);
62 ~GpuJpegDecodeAccelerator() override; 66 ~GpuJpegDecodeAccelerator() override;
63 67
64 void AddClient(int32_t route_id, base::Callback<void(bool)> response); 68 void AddClient(int32_t route_id, base::Callback<void(bool)> response);
65 69
66 void NotifyDecodeStatus(int32_t route_id, 70 void NotifyDecodeStatus(int32_t route_id,
67 int32_t bitstream_buffer_id, 71 int32_t bitstream_buffer_id,
68 JpegDecodeAccelerator::Error error); 72 JpegDecodeAccelerator::Error error);
69 73
74 // mojom::GpuJpegDecodeAccelerator implementation.
75 void Initialize(InitializeCallback callback) override;
76 void Decode(mojom::BitstreamBufferPtr input_buffer,
77 const gfx::Size& coded_size,
78 mojo::ScopedSharedBufferHandle output_handle,
79 uint32_t output_buffer_size,
80 DecodeCallback callback) override;
81 void Uninitialize() override;
82
70 // Function to delegate sending to actual sender. 83 // Function to delegate sending to actual sender.
71 bool Send(IPC::Message* message) override; 84 bool Send(IPC::Message* message) override;
72 85
73 private: 86 private:
74 class Client; 87 class Client;
75 class MessageFilter; 88 class MessageFilter;
76 89
77 void ClientRemoved(); 90 void ClientRemoved();
78 91
79 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> 92 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB>
(...skipping 14 matching lines...) Expand all
94 int client_number_; 107 int client_number_;
95 108
96 SEQUENCE_CHECKER(sequence_checker_); 109 SEQUENCE_CHECKER(sequence_checker_);
97 110
98 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); 111 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator);
99 }; 112 };
100 113
101 } // namespace media 114 } // namespace media
102 115
103 #endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ 116 #endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « media/gpu/ipc/service/BUILD.gn ('k') | media/gpu/ipc/service/gpu_jpeg_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698