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 #include "ui/ozone/public/ozone_gpu_test_helper.h" | 5 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | |
8 #include "base/run_loop.h" | |
7 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
8 #include "ipc/ipc_listener.h" | 10 #include "ipc/ipc_listener.h" |
9 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.h" |
11 #include "ipc/message_filter.h" | 13 #include "ipc/message_filter.h" |
12 #include "ui/ozone/public/gpu_platform_support.h" | 14 #include "ui/ozone/public/gpu_platform_support.h" |
13 #include "ui/ozone/public/gpu_platform_support_host.h" | 15 #include "ui/ozone/public/gpu_platform_support_host.h" |
14 #include "ui/ozone/public/ozone_platform.h" | 16 #include "ui/ozone/public/ozone_platform.h" |
15 | 17 |
16 namespace ui { | 18 namespace ui { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO, | 107 FROM_HERE, base::Bind(&FakeGpuProcess::InitOnIO, |
106 base::Unretained(fake_gpu_process_.get()))); | 108 base::Unretained(fake_gpu_process_.get()))); |
107 fake_gpu_process_->Init(); | 109 fake_gpu_process_->Init(); |
108 | 110 |
109 fake_gpu_process_host_.reset(new FakeGpuProcessHost(gpu_task_runner)); | 111 fake_gpu_process_host_.reset(new FakeGpuProcessHost(gpu_task_runner)); |
110 fake_gpu_process_host_->Init(); | 112 fake_gpu_process_host_->Init(); |
111 | 113 |
112 return true; | 114 return true; |
113 } | 115 } |
114 | 116 |
117 // static | |
118 scoped_ptr<OzoneInitializerForTest> OzoneInitializerForTest::Create() { | |
119 scoped_ptr<OzoneInitializerForTest> self(new OzoneInitializerForTest()); | |
120 if (!self->Initialize()) | |
121 return nullptr; | |
122 return self.Pass(); | |
123 } | |
124 | |
125 OzoneInitializerForTest::OzoneInitializerForTest() { | |
126 } | |
127 | |
128 OzoneInitializerForTest::~OzoneInitializerForTest() { | |
129 } | |
130 | |
131 bool OzoneInitializerForTest::Initialize() { | |
132 scoped_ptr<base::MessageLoop> message_loop; | |
133 if (!base::MessageLoop::current()) | |
134 message_loop.reset(new base::MessageLoopForUI); | |
dshwang
2015/07/15 16:02:41
MessageLoopForUI creation is ugly, but OzonePlatfo
dshwang
2015/07/15 16:07:19
another solution is to move `gfx::GLSurface::Initi
| |
135 | |
136 OzonePlatform::InitializeForUI(); | |
137 OzonePlatform::InitializeForGPU(); | |
138 gpu_helper_.reset(new OzoneGpuTestHelper); | |
139 if (!gpu_helper_->Initialize(base::ThreadTaskRunnerHandle::Get(), | |
140 base::ThreadTaskRunnerHandle::Get())) { | |
141 return false; | |
142 } | |
143 { | |
144 base::MessageLoop::ScopedNestableTaskAllower allow( | |
145 base::MessageLoop::current()); | |
146 base::RunLoop().RunUntilIdle(); | |
147 } | |
148 return true; | |
149 } | |
150 | |
115 } // namespace ui | 151 } // namespace ui |
OLD | NEW |