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

Unified 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: rebased with new ArcBridgeService; addressed Owen's comments Created 5 years 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 side-by-side diff with in-line comments
Download patch
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..b148eed3a213e072ab27febc0f9b926b02f61b09
--- /dev/null
+++ b/content/common/gpu/media/gpu_arc_video_service.h
@@ -0,0 +1,88 @@
+// 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/memory/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread.h"
+#include "media/video/arc_video_accelerator.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+class WaitableEvent;
+}
+
+namespace IPC {
+class Sender;
+}
+
+namespace content {
+
+// GpuArcVideoService manages life-cycle and IPC message translation for
+// ArcVideoAccelerator.
+//
+// For each creation requests from GpuChannelManager, GpuArcVideoService will
+// create a new IPC channel. All messages to ArcVideoAccelerator are handled on
+// |arc_video_accelerator_thread_|.
+class GpuArcVideoService : public base::NonThreadSafe {
+ public:
+ class AcceleratorStub;
+
+ // |gpu_channel_manager| is used to send reply message for CreateChannel.
+ // |shutdown_event| should signal an event when this process shutdown in
+ // order to notify our new IPC channel to terminate.
+ GpuArcVideoService(
+ IPC::Sender* gpu_channel_manager,
+ 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, as an IPC message,
+ // will be send
+ // back via |gpu_channel_manager_|.
+ void CreateChannel();
Owen Lin 2015/12/15 03:04:06 I mean if we have a callback for this function. It
kcwu 2015/12/16 14:05:33 Done.
+
+ // Removes the reference of |stub| (and trigger deletion) from this class.
+ void RemoveClientOnArcThread(AcceleratorStub* stub);
+
+ private:
+ void CreateClientOnArcThread();
+ void RemoveAllClientsOnArcThread(base::WaitableEvent* done);
+
+ // |gpu_channel_manager_| outlives this class. So a raw pointer is safe.
+ IPC::Sender* gpu_channel_manager_;
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698