Index: content/common/gpu/client/gpu_arc_accelerator_host.h |
diff --git a/content/common/gpu/client/gpu_arc_accelerator_host.h b/content/common/gpu/client/gpu_arc_accelerator_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..90473e6a6e8bcf32f0ee4b89a767c31977f99fec |
--- /dev/null |
+++ b/content/common/gpu/client/gpu_arc_accelerator_host.h |
@@ -0,0 +1,57 @@ |
+// 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_CLIENT_GPU_ARC_ACCELERATOR_HOST_H_ |
+#define CONTENT_COMMON_GPU_CLIENT_GPU_ARC_ACCELERATOR_HOST_H_ |
+ |
+#include <queue> |
+ |
+#include "base/callback.h" |
+#include "base/memory/weak_ptr.h" |
+#include "base/threading/non_thread_safe.h" |
+#include "ipc/ipc_channel_handle.h" |
+#include "ipc/ipc_listener.h" |
+ |
+namespace content { |
+class GpuChannelHost; |
+ |
+// kcwu: Should this class be folded into GpuProcessHost? |
Owen Lin
2015/11/26 03:54:41
I changed my mind. Let's keep this class. But how
kcwu
2015/11/26 10:34:42
Done.
Nice idea. This name is better.
|
+class GpuArcAcceleratorHost |
+ : public IPC::Listener, |
+ public base::NonThreadSafe, |
+ public base::SupportsWeakPtr<GpuArcAcceleratorHost> { |
+ public: |
+ using CreatedCallback = base::Callback<void(IPC::ChannelHandle, uint32_t)>; |
+ GpuArcAcceleratorHost(); |
+ ~GpuArcAcceleratorHost() override; |
+ |
+ // IPC::Listener implementation. |
+ void OnChannelError() override; |
+ bool OnMessageReceived(const IPC::Message& message) override; |
+ |
+ // Creates one arc accelerator with |device_type|. Created channel and |
+ // intialization result are passed back by |cb|. |
+ void CreateArcAccelerator(uint32_t device_type, const CreatedCallback& cb); |
Owen Lin
2015/11/26 03:54:40
I would prefer keep it cleaner for know. If we do
kcwu
2015/11/26 10:34:42
Done.
|
+ |
+ // Shutdowns all existing arc accelerators and abort all pending requests. |
+ void Shutdown(); |
+ |
+ private: |
+ void AbortPendingRequests(); |
+ void GpuChannelEstablished(uint32_t device_type, const CreatedCallback& cb); |
+ void CreateArcAcceleratorWithGpuChannel(uint32_t device_type, |
+ const CreatedCallback& cb); |
+ |
+ void OnArcAcceleratorCreated(IPC::ChannelHandle handle, uint32_t result); |
+ |
+ int32_t route_id_; |
+ scoped_refptr<GpuChannelHost> gpu_channel_host_; |
Owen Lin
2015/11/26 03:54:41
As we discussed, Can we just use GpuProcessHost? W
kcwu
2015/11/26 10:34:42
GpuChannelHost and BrowserGpuChannelHostFactory do
|
+ std::queue<CreatedCallback> pending_requests_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GpuArcAcceleratorHost); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_CLIENT_GPU_ARC_ACCELERATOR_HOST_H_ |