Chromium Code Reviews| Index: content/common/gpu/media/gpu_arc_video_service.h |
| diff --git a/content/common/gpu/media/gpu_arc_video_service.h b/content/common/gpu/media/gpu_arc_video_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..25916cbe91865948f5d3fae47da80ba609107798 |
| --- /dev/null |
| +++ b/content/common/gpu/media/gpu_arc_video_service.h |
| @@ -0,0 +1,83 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_COMMON_GPU_MEDIA_GPU_ARC_VIDEO_SERVICE_H_ |
| +#define CONTENT_COMMON_GPU_MEDIA_GPU_ARC_VIDEO_SERVICE_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "base/threading/thread.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +class WaitableEvent; |
| +} |
| + |
| +namespace IPC { |
| +struct ChannelHandle; |
| +} |
| + |
| +namespace content { |
| + |
| +// GpuArcVideoService manages life-cycle and IPC message translation for |
| +// ArcVideoAccelerator. |
| +// |
| +// 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.
|
| +// create a new IPC channel. All messages to ArcVideoAccelerator are handled on |
| +// |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.
|
| +class GpuArcVideoService : public base::NonThreadSafe { |
| + public: |
| + class AcceleratorStub; |
| + using CreateChannelCallback = base::Callback<void(const IPC::ChannelHandle&)>; |
| + |
| + // |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.
|
| + // order to notify our new IPC channel to terminate. |
| + GpuArcVideoService( |
| + base::WaitableEvent* shutdown_event, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| + |
| + // Upon deletion, all ArcVideoAccelerator will be deleted and the associated |
| + // IPC channels are closed. |
| + ~GpuArcVideoService(); |
| + |
| + void Initialize(); |
| + |
| + // 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.
|
| + // |callback|. |
| + void CreateChannel(const CreateChannelCallback& callback); |
| + |
| + // Removes the reference of |stub| (and trigger deletion) from this class. |
| + void RemoveClientOnArcThread(AcceleratorStub* stub); |
| + |
| + private: |
| + void CreateClientOnArcThread(const CreateChannelCallback& callback); |
| + void RemoveAllClientsOnArcThread(base::WaitableEvent* done); |
| + |
| + // Shutdown event of GPU process. |
| + base::WaitableEvent* shutdown_event_; |
| + |
| + // GPU io thread task runner. |
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| + |
| + // GPU main thread task runner. |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| + |
| + // Arc accelerator thread. |
| + base::Thread arc_video_accelerator_thread_; |
| + |
| + // Arc accelerator task runner. |
| + scoped_refptr<base::SingleThreadTaskRunner> arc_task_runner_; |
| + |
| + // Bookkeeping all accelerator stubs. Only accessed on arc thread. |
| + std::map<AcceleratorStub*, scoped_ptr<AcceleratorStub>> accelerator_stubs_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(GpuArcVideoService); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_GPU_MEDIA_GPU_ARC_VIDEO_SERVICE_H_ |