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_MEDIA_GPU_ARC_VIDEO_SERVICE_H_ | |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_ARC_VIDEO_SERVICE_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/threading/non_thread_safe.h" | |
12 | |
13 namespace base { | |
14 class SingleThreadTaskRunner; | |
15 class WaitableEvent; | |
16 } | |
17 | |
18 namespace IPC { | |
19 struct ChannelHandle; | |
20 } | |
21 | |
22 namespace content { | |
23 | |
24 // GpuArcVideoService manages life-cycle and IPC message translation for | |
25 // ArcVideoAccelerator. | |
26 // | |
27 // For each creation request from GpuChannelManager, GpuArcVideoService will | |
28 // create a new IPC channel. | |
29 class GpuArcVideoService : public base::NonThreadSafe { | |
30 public: | |
31 class AcceleratorStub; | |
32 using CreateChannelCallback = base::Callback<void(const IPC::ChannelHandle&)>; | |
33 | |
34 // |shutdown_event| should signal an event when this process is about to be | |
35 // shut down in order to notify our new IPC channel to terminate. | |
36 GpuArcVideoService( | |
37 base::WaitableEvent* shutdown_event, | |
38 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | |
39 | |
40 // Upon deletion, all ArcVideoAccelerator will be deleted and the associated | |
41 // IPC channels are closed. | |
42 ~GpuArcVideoService(); | |
43 | |
44 // Creates a new accelerator stub. The creation result will be sent back via | |
45 // |callback|. | |
46 void CreateChannel(const CreateChannelCallback& callback); | |
47 | |
48 // Removes the reference of |stub| (and trigger deletion) from this class. | |
49 void RemoveClient(AcceleratorStub* stub); | |
50 | |
51 private: | |
52 // Shutdown event of GPU process. | |
53 base::WaitableEvent* shutdown_event_; | |
54 | |
55 // GPU io thread task runner. | |
56 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
57 | |
58 // Bookkeeping all accelerator stubs. | |
59 std::map<AcceleratorStub*, scoped_ptr<AcceleratorStub>> accelerator_stubs_; | |
60 | |
61 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuArcVideoService); | |
dcheng
2015/12/29 00:43:23
DISALLOW_COPY_AND_ASSIGN instead is much more comm
kcwu
2015/12/29 03:36:32
Done.
| |
62 }; | |
63 | |
64 } // namespace content | |
65 | |
66 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_ARC_VIDEO_SERVICE_H_ | |
OLD | NEW |