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_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_ARC_ACCELERATOR_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" |
| 13 #include "base/threading/thread.h" |
| 14 #include "media/video/arc_video_accelerator.h" |
| 15 |
| 16 namespace base { |
| 17 class SingleThreadTaskRunner; |
| 18 class WaitableEvent; |
| 19 } |
| 20 |
| 21 namespace IPC { |
| 22 struct ChannelHandle; |
| 23 } |
| 24 |
| 25 namespace content { |
| 26 class GpuChannel; |
| 27 |
| 28 class GpuArcAccelerator : public base::NonThreadSafe { |
| 29 public: |
| 30 class Client; |
| 31 |
| 32 GpuArcAccelerator( |
| 33 GpuChannel* channel, |
| 34 base::WaitableEvent* shutdown_event, |
| 35 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 36 ~GpuArcAccelerator(); |
| 37 |
| 38 void Initialize(); |
| 39 |
| 40 void CreateClient(uint32_t device_type); |
| 41 |
| 42 void RemoveClientOnArcThread(Client* client); |
| 43 |
| 44 private: |
| 45 void CreateClientOnArcThread(uint32_t device_type); |
| 46 void RemoveAllClientsOnArcThread(base::WaitableEvent* done); |
| 47 |
| 48 // GpuChannel outlives this class. So a raw pointer is safe. |
| 49 GpuChannel* gpu_channel_; |
| 50 |
| 51 // Shutdown event of GPU process. |
| 52 base::WaitableEvent* shutdown_event_; |
| 53 |
| 54 // GPU io thread task runner. |
| 55 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 56 |
| 57 // GPU main thread task runner. |
| 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 59 |
| 60 // Arc accelerator thread. |
| 61 base::Thread arc_accelerator_thread_; |
| 62 |
| 63 // Arc accelerator task runner. |
| 64 scoped_refptr<base::SingleThreadTaskRunner> arc_task_runner_; |
| 65 |
| 66 // Bookkeeping all clients. Only accessed on arc thread. |
| 67 std::map<Client*, scoped_ptr<Client>> clients_; |
| 68 |
| 69 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuArcAccelerator); |
| 70 }; |
| 71 |
| 72 } // namespace content |
| 73 |
| 74 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_ARC_ACCELERATOR_H_ |
OLD | NEW |