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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SEM_FAILCRITICALERRORS | | 186 SEM_FAILCRITICALERRORS | |
187 SEM_NOGPFAULTERRORBOX | | 187 SEM_NOGPFAULTERRORBOX | |
188 SEM_NOOPENFILEERRORBOX); | 188 SEM_NOOPENFILEERRORBOX); |
189 #elif defined(USE_X11) | 189 #elif defined(USE_X11) |
190 ui::SetDefaultX11ErrorHandlers(); | 190 ui::SetDefaultX11ErrorHandlers(); |
191 | 191 |
192 #endif | 192 #endif |
193 | 193 |
194 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 194 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
195 | 195 |
| 196 // We are experiencing what appear to be memory-stomp issues in the GPU |
| 197 // process. These issues seem to be impacting the message loop and listeners |
| 198 // registered to it. Create the message loop on the heap to guard against |
| 199 // this. |
| 200 // TODO(ericrk): Revisit this once we assess its impact on crbug.com/662802 |
| 201 // and crbug.com/609252. |
| 202 std::unique_ptr<base::MessageLoop> main_message_loop; |
| 203 |
196 #if defined(OS_WIN) | 204 #if defined(OS_WIN) |
197 // OK to use default non-UI message loop because all GPU windows run on | 205 // OK to use default non-UI message loop because all GPU windows run on |
198 // dedicated thread. | 206 // dedicated thread. |
199 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); | 207 main_message_loop.reset( |
| 208 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
200 #elif defined(USE_X11) | 209 #elif defined(USE_X11) |
201 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX | 210 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
202 // and https://crbug.com/326995. | 211 // and https://crbug.com/326995. |
203 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 212 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
204 std::unique_ptr<ui::PlatformEventSource> event_source = | 213 std::unique_ptr<ui::PlatformEventSource> event_source = |
205 ui::PlatformEventSource::CreateDefault(); | 214 ui::PlatformEventSource::CreateDefault(); |
206 #elif defined(USE_OZONE) && defined(OZONE_X11) | 215 #elif defined(USE_OZONE) && defined(OZONE_X11) |
207 // If we might be running Ozone X11 we need a UI loop to grab Expose events. | 216 // If we might be running Ozone X11 we need a UI loop to grab Expose events. |
208 // See GLSurfaceGLX and https://crbug.com/326995. | 217 // See GLSurfaceGLX and https://crbug.com/326995. |
209 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 218 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
210 #elif defined(USE_OZONE) | 219 #elif defined(USE_OZONE) |
211 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); | 220 main_message_loop.reset( |
| 221 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
212 #elif defined(OS_LINUX) | 222 #elif defined(OS_LINUX) |
213 #error "Unsupported Linux platform." | 223 #error "Unsupported Linux platform." |
214 #elif defined(OS_MACOSX) | 224 #elif defined(OS_MACOSX) |
215 // This is necessary for CoreAnimation layers hosted in the GPU process to be | 225 // This is necessary for CoreAnimation layers hosted in the GPU process to be |
216 // drawn. See http://crbug.com/312462. | 226 // drawn. See http://crbug.com/312462. |
217 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); | 227 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); |
218 base::MessageLoop main_message_loop(std::move(pump)); | 228 main_message_loop.reset(new base::MessageLoop(std::move(pump))); |
219 #else | 229 #else |
220 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); | 230 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO)); |
221 #endif | 231 #endif |
222 | 232 |
223 base::PlatformThread::SetName("CrGpuMain"); | 233 base::PlatformThread::SetName("CrGpuMain"); |
224 | 234 |
225 // Initializes StatisticsRecorder which tracks UMA histograms. | 235 // Initializes StatisticsRecorder which tracks UMA histograms. |
226 base::StatisticsRecorder::Initialize(); | 236 base::StatisticsRecorder::Initialize(); |
227 | 237 |
228 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 238 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
229 // Set thread priority before sandbox initialization. | 239 // Set thread priority before sandbox initialization. |
230 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 240 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 return true; | 350 return true; |
341 } | 351 } |
342 | 352 |
343 return false; | 353 return false; |
344 } | 354 } |
345 #endif // defined(OS_WIN) | 355 #endif // defined(OS_WIN) |
346 | 356 |
347 } // namespace. | 357 } // namespace. |
348 | 358 |
349 } // namespace content | 359 } // namespace content |
OLD | NEW |