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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); | 195 logging::SetLogMessageHandler(GpuProcessLogMessageHandler); |
196 | 196 |
197 // We are experiencing what appear to be memory-stomp issues in the GPU | 197 // We are experiencing what appear to be memory-stomp issues in the GPU |
198 // process. These issues seem to be impacting the message loop and listeners | 198 // process. These issues seem to be impacting the message loop and listeners |
199 // registered to it. Create the message loop on the heap to guard against | 199 // registered to it. Create the message loop on the heap to guard against |
200 // this. | 200 // this. |
201 // TODO(ericrk): Revisit this once we assess its impact on crbug.com/662802 | 201 // TODO(ericrk): Revisit this once we assess its impact on crbug.com/662802 |
202 // and crbug.com/609252. | 202 // and crbug.com/609252. |
203 std::unique_ptr<base::MessageLoop> main_message_loop; | 203 std::unique_ptr<base::MessageLoop> main_message_loop; |
| 204 std::unique_ptr<ui::PlatformEventSource> event_source; |
204 if (command_line.HasSwitch(switches::kHeadless)) { | 205 if (command_line.HasSwitch(switches::kHeadless)) { |
205 main_message_loop.reset( | 206 main_message_loop.reset( |
206 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 207 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
207 } else { | 208 } else { |
208 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
209 // OK to use default non-UI message loop because all GPU windows run on | 210 // OK to use default non-UI message loop because all GPU windows run on |
210 // dedicated thread. | 211 // dedicated thread. |
211 main_message_loop.reset( | 212 main_message_loop.reset( |
212 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 213 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
213 #elif defined(USE_X11) | 214 #elif defined(USE_X11) |
214 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX | 215 // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX |
215 // and https://crbug.com/326995. | 216 // and https://crbug.com/326995. |
216 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | 217 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
217 std::unique_ptr<ui::PlatformEventSource> event_source = | 218 event_source = ui::PlatformEventSource::CreateDefault(); |
218 ui::PlatformEventSource::CreateDefault(); | |
219 #elif defined(USE_OZONE) && defined(OZONE_X11) | 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. | 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. | 221 // See GLSurfaceGLX and https://crbug.com/326995. |
222 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | 222 main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
223 #elif defined(USE_OZONE) | 223 #elif defined(USE_OZONE) |
224 main_message_loop.reset( | 224 main_message_loop.reset( |
225 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 225 new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
226 #elif defined(OS_LINUX) | 226 #elif defined(OS_LINUX) |
227 #error "Unsupported Linux platform." | 227 #error "Unsupported Linux platform." |
228 #elif defined(OS_MACOSX) | 228 #elif defined(OS_MACOSX) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 return true; | 355 return true; |
356 } | 356 } |
357 | 357 |
358 return false; | 358 return false; |
359 } | 359 } |
360 #endif // defined(OS_WIN) | 360 #endif // defined(OS_WIN) |
361 | 361 |
362 } // namespace. | 362 } // namespace. |
363 | 363 |
364 } // namespace content | 364 } // namespace content |
OLD | NEW |