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

Side by Side Diff: content/common/gpu/media/gpu_arc_video_service.h

Issue 1451353002: Implement GpuArcVideoService for arc video accelerator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and addressed luis's comments Created 4 years, 12 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
(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/memory/ref_counted.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "base/threading/thread.h"
14
15 namespace base {
16 class SingleThreadTaskRunner;
17 class WaitableEvent;
18 }
19
20 namespace IPC {
21 struct ChannelHandle;
22 }
23
24 namespace content {
25
26 // GpuArcVideoService manages life-cycle and IPC message translation for
27 // ArcVideoAccelerator.
28 //
29 // For each creation requests from GpuChannelManager, GpuArcVideoService will
Pawel Osciak 2015/12/23 06:24:01 s/requests/request/
kcwu 2015/12/23 09:09:43 Done.
30 // create a new IPC channel. All messages to ArcVideoAccelerator are handled on
31 // |arc_video_accelerator_thread_|.
Pawel Osciak 2015/12/23 06:24:01 It would be preferable to make all ArcVideoAcceler
kcwu 2015/12/23 09:09:43 Done.
32 class GpuArcVideoService : public base::NonThreadSafe {
33 public:
34 class AcceleratorStub;
35 using CreateChannelCallback = base::Callback<void(const IPC::ChannelHandle&)>;
36
37 // |shutdown_event| should signal an event when this process shutdown in
Pawel Osciak 2015/12/23 06:24:01 s/shutdown/is about to be shut down/ ?
kcwu 2015/12/23 09:09:43 Done.
38 // order to notify our new IPC channel to terminate.
39 GpuArcVideoService(
40 base::WaitableEvent* shutdown_event,
41 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
42
43 // Upon deletion, all ArcVideoAccelerator will be deleted and the associated
44 // IPC channels are closed.
45 ~GpuArcVideoService();
46
47 void Initialize();
48
49 // Creates a new accelerator stub. The creation result will be send back via
Pawel Osciak 2015/12/23 06:24:01 s/send/sent/
kcwu 2015/12/23 09:09:43 Done.
50 // |callback|.
51 void CreateChannel(const CreateChannelCallback& callback);
52
53 // Removes the reference of |stub| (and trigger deletion) from this class.
54 void RemoveClientOnArcThread(AcceleratorStub* stub);
55
56 private:
57 void CreateClientOnArcThread(const CreateChannelCallback& callback);
58 void RemoveAllClientsOnArcThread(base::WaitableEvent* done);
59
60 // Shutdown event of GPU process.
61 base::WaitableEvent* shutdown_event_;
62
63 // GPU io thread task runner.
64 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
65
66 // GPU main thread task runner.
67 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
68
69 // Arc accelerator thread.
70 base::Thread arc_video_accelerator_thread_;
71
72 // Arc accelerator task runner.
73 scoped_refptr<base::SingleThreadTaskRunner> arc_task_runner_;
74
75 // Bookkeeping all accelerator stubs. Only accessed on arc thread.
76 std::map<AcceleratorStub*, scoped_ptr<AcceleratorStub>> accelerator_stubs_;
77
78 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuArcVideoService);
79 };
80
81 } // namespace content
82
83 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_ARC_VIDEO_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698