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_CLIENT_GPU_ARC_ACCELERATOR_HOST_H_ | |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_ARC_ACCELERATOR_HOST_H_ | |
7 | |
8 #include <queue> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/threading/non_thread_safe.h" | |
13 #include "ipc/ipc_channel_handle.h" | |
14 #include "ipc/ipc_listener.h" | |
15 | |
16 namespace content { | |
17 class GpuChannelHost; | |
18 | |
19 // 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.
| |
20 class GpuArcAcceleratorHost | |
21 : public IPC::Listener, | |
22 public base::NonThreadSafe, | |
23 public base::SupportsWeakPtr<GpuArcAcceleratorHost> { | |
24 public: | |
25 using CreatedCallback = base::Callback<void(IPC::ChannelHandle, uint32_t)>; | |
26 GpuArcAcceleratorHost(); | |
27 ~GpuArcAcceleratorHost() override; | |
28 | |
29 // IPC::Listener implementation. | |
30 void OnChannelError() override; | |
31 bool OnMessageReceived(const IPC::Message& message) override; | |
32 | |
33 // Creates one arc accelerator with |device_type|. Created channel and | |
34 // intialization result are passed back by |cb|. | |
35 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.
| |
36 | |
37 // Shutdowns all existing arc accelerators and abort all pending requests. | |
38 void Shutdown(); | |
39 | |
40 private: | |
41 void AbortPendingRequests(); | |
42 void GpuChannelEstablished(uint32_t device_type, const CreatedCallback& cb); | |
43 void CreateArcAcceleratorWithGpuChannel(uint32_t device_type, | |
44 const CreatedCallback& cb); | |
45 | |
46 void OnArcAcceleratorCreated(IPC::ChannelHandle handle, uint32_t result); | |
47 | |
48 int32_t route_id_; | |
49 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
| |
50 std::queue<CreatedCallback> pending_requests_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(GpuArcAcceleratorHost); | |
53 }; | |
54 | |
55 } // namespace content | |
56 | |
57 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_ARC_ACCELERATOR_HOST_H_ | |
OLD | NEW |