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

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

Issue 2923933004: [NotForReview] Move GJDAH and GJDA to media/gpu/mojo
Patch Set: . 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
(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 MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_
6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h"
15 #include "base/sequence_checker.h"
16 #include "base/synchronization/waitable_event.h"
17 #include "ipc/ipc_listener.h"
18 #include "ipc/ipc_sender.h"
19 #include "media/gpu/mojo/jpeg_decoder.mojom.h"
20 #include "media/video/jpeg_decode_accelerator.h"
21
22 namespace base {
23 class SingleThreadTaskRunner;
24 }
25
26 namespace gpu {
27 class FilteredSender;
28 }
29
30 namespace media {
31
32 class GpuJpegDecodeAcceleratorFactoryProvider {
33 public:
34 using CreateAcceleratorCB =
35 base::Callback<std::unique_ptr<JpegDecodeAccelerator>(
36 scoped_refptr<base::SingleThreadTaskRunner>)>;
37
38 // Static query for JPEG supported. This query calls the appropriate
39 // platform-specific version.
40 static bool IsAcceleratedJpegDecodeSupported();
41
42 static std::vector<CreateAcceleratorCB> GetAcceleratorFactories();
43 };
44
45 // TODO(c.padhi): Move GpuJpegDecodeAccelerator to media/gpu/mojo, see
46 // http://crbug.com/699255.
47 class GpuJpegDecodeAccelerator
48 : public IPC::Sender,
49 public mojom::GpuJpegDecodeAccelerator,
50 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> {
51 public:
52 // |channel| must outlive this object.
53 // This convenience constructor internally calls
54 // GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() to
55 // fill |accelerator_factory_functions_|.
56 GpuJpegDecodeAccelerator(
57 gpu::FilteredSender* channel,
58 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
59
60 // |channel| must outlive this object.
61 GpuJpegDecodeAccelerator(
62 gpu::FilteredSender* channel,
63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
64 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB>
65 accelerator_factory_functions);
66 ~GpuJpegDecodeAccelerator() override;
67
68 void AddClient(int32_t route_id, base::Callback<void(bool)> response);
69
70 void NotifyDecodeStatus(int32_t route_id,
71 int32_t bitstream_buffer_id,
72 JpegDecodeAccelerator::Error error);
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
83 // Function to delegate sending to actual sender.
84 bool Send(IPC::Message* message) override;
85
86 private:
87 class Client;
88 class MessageFilter;
89
90 void ClientRemoved();
91
92 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB>
93 accelerator_factory_functions_;
94
95 gpu::FilteredSender* channel_;
96
97 // The message filter to run JpegDecodeAccelerator::Decode on IO thread.
98 scoped_refptr<MessageFilter> filter_;
99
100 // GPU child task runner.
101 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_;
102
103 // GPU IO task runner.
104 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
105
106 // Number of clients added to |filter_|.
107 int client_number_;
108
109 SEQUENCE_CHECKER(sequence_checker_);
110
111 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator);
112 };
113
114 } // namespace media
115
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