Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / ozone / public / ozone_gpu_test_helper.h
blobe3428656ad5a680a93a9af67e98890e5298cced6
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
3 // found in the LICENSE file.
5 #ifndef UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_
6 #define UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/ozone/ozone_export.h"
12 namespace base {
13 class SingleThreadTaskRunner;
14 class Thread;
17 namespace ui {
19 class FakeGpuProcess;
20 class FakeGpuProcessHost;
22 // Helper class for applications that do not have a dedicated GPU channel.
24 // This sets up message forwarding between the "gpu" and "ui" threads.
25 class OZONE_EXPORT OzoneGpuTestHelper {
26 public:
27 OzoneGpuTestHelper();
28 virtual ~OzoneGpuTestHelper();
30 // Start processing gpu messages. The host process will be using the
31 // |gpu_task_runner| to post messages intended for the GPU thread. The "gpu"
32 // process will be using the |ui_task_runner| to post messages intended for
33 // the "ui" thread.
34 bool Initialize(
35 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
36 const scoped_refptr<base::SingleThreadTaskRunner>& gpu_task_runner);
38 private:
39 scoped_ptr<FakeGpuProcess> fake_gpu_process_;
40 scoped_ptr<FakeGpuProcessHost> fake_gpu_process_host_;
41 scoped_ptr<base::Thread> io_helper_thread_;
43 DISALLOW_COPY_AND_ASSIGN(OzoneGpuTestHelper);
46 } // namespace ui
48 #endif // UI_OZONE_PUBLIC_OZONE_GPU_THREAD_HELPER_H_