Chromium Code Reviews| Index: chrome/gpu/gpu_arc_video_service.h |
| diff --git a/chrome/gpu/gpu_arc_video_service.h b/chrome/gpu/gpu_arc_video_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0367f71cbc21d45c6096e7dc07edd1cee4d123c3 |
| --- /dev/null |
| +++ b/chrome/gpu/gpu_arc_video_service.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2016 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 CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
| +#define CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/macros.h" |
| +#include "components/arc/common/video.mojom.h" |
| +#include "mojo/public/cpp/bindings/strong_binding.h" |
| + |
| +namespace chromeos { |
| +namespace arc { |
| + |
| +// GpuArcVideoService manages life-cycle and IPC message translation for |
| +// ArcVideoAccelerator. |
| +// |
| +// For each creation request from GpuArcVideoServiceHost, GpuArcVideoService |
| +// will create a new IPC channel. |
| +class GpuArcVideoService : public ::arc::VideoHost { |
| + public: |
| + class AcceleratorStub; |
| + |
| + // |request| is mojo interface request of arc::VideoHost. |
| + explicit GpuArcVideoService(mojo::InterfaceRequest<::arc::VideoHost> request); |
| + |
| + // Upon deletion, all ArcVideoAccelerator will be deleted and the associated |
| + // IPC channels are closed. |
| + ~GpuArcVideoService() override; |
| + |
| + // Removes the reference of |stub| (and trigger deletion) from this class. |
| + void RemoveClient(AcceleratorStub* stub); |
| + |
| + private: |
| + // arc::VideoHost implementation. |
| + void OnRequestArcVideoAcceleratorChannel( |
| + const OnRequestArcVideoAcceleratorChannelCallback& callback) override; |
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| + // Binding of arc::VideoHost. It also takes ownership of |this|. |
| + mojo::StrongBinding<::arc::VideoHost> binding_; |
| + |
| + // Bookkeeping all accelerator stubs. |
| + std::map<AcceleratorStub*, scoped_ptr<AcceleratorStub>> accelerator_stubs_; |
|
dcheng
2016/04/07 02:17:57
Use unique_ptr. Also, don't forget to #include <me
kcwu
2016/04/07 08:17:57
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(GpuArcVideoService); |
| +}; |
| + |
| +} // namespace arc |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_GPU_GPU_ARC_VIDEO_SERVICE_H_ |