Chromium Code Reviews| 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. | |
|
Ken Russell (switch to Gerrit)
2016/11/29 03:02:27
Please refer to the bug ID in the comment. Thanks.
| |
| 200 std::unique_ptr<base::MessageLoop> main_message_loop; | |
| 201 | |
| 196 #if defined(OS_WIN) | 202 #if defined(OS_WIN) |
| 197 // OK to use default non-UI message loop because all GPU windows run on | 203 // OK to use default non-UI message loop because all GPU windows run on |
| 198 // dedicated thread. | 204 // dedicated thread. |
| 199 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); | 205 main_message_loop.reset( |
| 206 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | |
| 200 #elif defined(USE_X11) | 207 #elif defined(USE_X11) |
| 201 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX | 208 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
| 202 // and https://crbug.com/326995. | 209 // and https://crbug.com/326995. |
| 203 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 210 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
| 204 std::unique_ptr<ui::PlatformEventSource> event_source = | 211 std::unique_ptr<ui::PlatformEventSource> event_source = |
| 205 ui::PlatformEventSource::CreateDefault(); | 212 ui::PlatformEventSource::CreateDefault(); |
| 206 #elif defined(USE_OZONE) && defined(OZONE_X11) | 213 #elif defined(USE_OZONE) && defined(OZONE_X11) |
| 207 // If we might be running Ozone X11 we need a UI loop to grab Expose events. | 214 // If we might be running Ozone X11 we need a UI loop to grab Expose events. |
| 208 // See GLSurfaceGLX and https://crbug.com/326995. | 215 // See GLSurfaceGLX and https://crbug.com/326995. |
| 209 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); | 216 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
| 210 #elif defined(USE_OZONE) | 217 #elif defined(USE_OZONE) |
| 211 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT); | 218 main_message_loop.reset( |
| 219 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | |
| 212 #elif defined(OS_LINUX) | 220 #elif defined(OS_LINUX) |
| 213 #error "Unsupported Linux platform." | 221 #error "Unsupported Linux platform." |
| 214 #elif defined(OS_MACOSX) | 222 #elif defined(OS_MACOSX) |
| 215 // This is necessary for CoreAnimation layers hosted in the GPU process to be | 223 // This is necessary for CoreAnimation layers hosted in the GPU process to be |
| 216 // drawn. See http://crbug.com/312462. | 224 // drawn. See http://crbug.com/312462. |
| 217 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); | 225 std::unique_ptr<base::MessagePump> pump(new base::MessagePumpCFRunLoop()); |
| 218 base::MessageLoop main_message_loop(std::move(pump)); | 226 main_message_loop.reset(new base::MessageLoop(std::move(pump))); |
| 219 #else | 227 #else |
| 220 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_IO); | 228 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_IO)); |
| 221 #endif | 229 #endif |
| 222 | 230 |
| 223 base::PlatformThread::SetName("CrGpuMain"); | 231 base::PlatformThread::SetName("CrGpuMain"); |
| 224 | 232 |
| 225 // Initializes StatisticsRecorder which tracks UMA histograms. | 233 // Initializes StatisticsRecorder which tracks UMA histograms. |
| 226 base::StatisticsRecorder::Initialize(); | 234 base::StatisticsRecorder::Initialize(); |
| 227 | 235 |
| 228 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 236 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 229 // Set thread priority before sandbox initialization. | 237 // Set thread priority before sandbox initialization. |
| 230 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 238 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 return true; | 348 return true; |
| 341 } | 349 } |
| 342 | 350 |
| 343 return false; | 351 return false; |
| 344 } | 352 } |
| 345 #endif // defined(OS_WIN) | 353 #endif // defined(OS_WIN) |
| 346 | 354 |
| 347 } // namespace. | 355 } // namespace. |
| 348 | 356 |
| 349 } // namespace content | 357 } // namespace content |
| OLD | NEW |