OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_ | 5 #ifndef UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_ |
6 #define UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_ | 6 #define UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "ui/ozone/ozone_export.h" | 12 #include "ui/ozone/ozone_export.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
15 class Thread; | 16 class Thread; |
16 } | 17 } |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 | 20 |
20 class FakeGpuProcess; | 21 class FakeGpuProcess; |
21 class FakeGpuProcessHost; | 22 class FakeGpuProcessHost; |
22 | 23 |
23 // Helper class for applications that do not have a dedicated GPU channel. | 24 // Helper class for applications that do not have a dedicated GPU channel. |
24 // | 25 // |
25 // This sets up message forwarding between the "gpu" and "ui" threads. | 26 // This sets up message forwarding between the "gpu" and "ui" threads. |
26 class OZONE_EXPORT OzoneGpuTestHelper { | 27 class OZONE_EXPORT OzoneGpuTestHelper { |
27 public: | 28 public: |
28 OzoneGpuTestHelper(); | 29 OzoneGpuTestHelper(); |
29 virtual ~OzoneGpuTestHelper(); | 30 virtual ~OzoneGpuTestHelper(); |
30 | 31 |
31 // Start processing gpu messages. The host process will be using the | 32 // Start processing gpu messages. The host process will be using the |
32 // |gpu_task_runner| to post messages intended for the GPU thread. The "gpu" | 33 // |gpu_task_runner| to post messages intended for the GPU thread. The "gpu" |
33 // process will be using the |ui_task_runner| to post messages intended for | 34 // process will be using the |ui_task_runner| to post messages intended for |
34 // the "ui" thread. | 35 // the "ui" thread. |
35 bool Initialize( | 36 bool Initialize( |
36 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 37 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
37 const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner); | 38 const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner); |
38 | 39 |
39 private: | 40 private: |
40 scoped_ptr<FakeGpuProcess> fake_gpu_process_; | 41 std::unique_ptr<FakeGpuProcess> fake_gpu_process_; |
41 scoped_ptr<FakeGpuProcessHost> fake_gpu_process_host_; | 42 std::unique_ptr<FakeGpuProcessHost> fake_gpu_process_host_; |
42 scoped_ptr<base::Thread> io_helper_thread_; | 43 std::unique_ptr<base::Thread> io_helper_thread_; |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(OzoneGpuTestHelper); | 45 DISALLOW_COPY_AND_ASSIGN(OzoneGpuTestHelper); |
45 }; | 46 }; |
46 | 47 |
47 } // namespace ui | 48 } // namespace ui |
48 | 49 |
49 #endif // UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_ | 50 #endif // UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_ |
OLD | NEW |