OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 #if defined(OS_WIN) | 162 #if defined(OS_WIN) |
163 const sandbox::SandboxInterfaceInfo* sandbox_info_ = nullptr; | 163 const sandbox::SandboxInterfaceInfo* sandbox_info_ = nullptr; |
164 #elif defined(OS_LINUX) | 164 #elif defined(OS_LINUX) |
165 gpu::GpuInit* gpu_init_ = nullptr; | 165 gpu::GpuInit* gpu_init_ = nullptr; |
166 #endif | 166 #endif |
167 | 167 |
168 DISALLOW_COPY_AND_ASSIGN(ContentSandboxHelper); | 168 DISALLOW_COPY_AND_ASSIGN(ContentSandboxHelper); |
169 }; | 169 }; |
170 | 170 |
171 } // namespace anonymous | 171 } // namespace |
172 | 172 |
173 // Main function for starting the Gpu process. | 173 // Main function for starting the Gpu process. |
174 int GpuMain(const MainFunctionParams& parameters) { | 174 int GpuMain(const MainFunctionParams& parameters) { |
175 TRACE_EVENT0("gpu", "GpuMain"); | 175 TRACE_EVENT0("gpu", "GpuMain"); |
176 base::trace_event::TraceLog::GetInstance()->SetProcessName("GPU Process"); | 176 base::trace_event::TraceLog::GetInstance()->SetProcessName("GPU Process"); |
177 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( | 177 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( |
178 kTraceEventGpuProcessSortIndex); | 178 kTraceEventGpuProcessSortIndex); |
179 | 179 |
180 const base::CommandLine& command_line = parameters.command_line; | 180 const base::CommandLine& command_line = parameters.command_line; |
181 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { | 181 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { |
(...skipping 21 matching lines...) Expand all Loading... |
203 | 203 |
204 #endif | 204 #endif |
205 | 205 |
206 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 206 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
207 | 207 |
208 #if defined(OS_WIN) | 208 #if defined(OS_WIN) |
209 // Use a UI message loop because ANGLE and the desktop GL platform can | 209 // Use a UI message loop because ANGLE and the desktop GL platform can |
210 // create child windows to render to. | 210 // create child windows to render to. |
211 base::MessagePumpForGpu::InitFactory(); | 211 base::MessagePumpForGpu::InitFactory(); |
212 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 212 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); |
213 #elif defined(OS_LINUX) && defined(USE_X11) | 213 #elif defined(USE_X11) |
214 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX | 214 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
215 // and https://crbug.com/326995. | 215 // and https://crbug.com/326995. |
216 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 216 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); |
217 std::unique_ptr<ui::PlatformEventSource> event_source = | 217 std::unique_ptr<ui::PlatformEventSource> event_source = |
218 ui::PlatformEventSource::CreateDefault(); | 218 ui::PlatformEventSource::CreateDefault(); |
| 219 #elif defined(USE_OZONE) && defined(OZONE_X11) |
| 220 // If we might be running Ozone X11 we need a UI loop to grab Expose events. |
| 221 // See GLSurfaceGLX and https://crbug.com/326995. |
| 222 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); |
| 223 #elif defined(USE_OZONE) |
| 224 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); |
219 #elif defined(OS_LINUX) | 225 #elif defined(OS_LINUX) |
220 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); | 226 #error "Unsupported Linux platform." |
221 #elif defined(OS_MACOSX) | 227 #elif defined(OS_MACOSX) |
222 // This is necessary for CoreAnimation layers hosted in the GPU process to be | 228 // This is necessary for CoreAnimation layers hosted in the GPU process to be |
223 // drawn. See http://crbug.com/312462. | 229 // drawn. See http://crbug.com/312462. |
224 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); | 230 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); |
225 base::MessageLoop main_message_loop(std::move(pump)); | 231 base::MessageLoop main_message_loop(std::move(pump)); |
226 #else | 232 #else |
227 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); | 233 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); |
228 #endif | 234 #endif |
229 | 235 |
230 base::PlatformThread::SetName("CrGpuMain"); | 236 base::PlatformThread::SetName("CrGpuMain"); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 return true; | 357 return true; |
352 } | 358 } |
353 | 359 |
354 return false; | 360 return false; |
355 } | 361 } |
356 #endif // defined(OS_WIN) | 362 #endif // defined(OS_WIN) |
357 | 363 |
358 } // namespace. | 364 } // namespace. |
359 | 365 |
360 } // namespace content | 366 } // namespace content |
OLD | NEW |