| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
| 8 #include "app/gfx/gl/gl_context.h" | 8 #include "app/gfx/gl/gl_context.h" |
| 9 #include "app/gfx/gl/gl_implementation.h" | 9 #include "app/gfx/gl/gl_implementation.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 PlatformThread::SetName("CrGpuMain"); | 83 PlatformThread::SetName("CrGpuMain"); |
| 84 | 84 |
| 85 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
| 86 win_util::ScopedCOMInitializer com_initializer; | 86 win_util::ScopedCOMInitializer com_initializer; |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 #if defined(USE_X11) | 89 #if defined(USE_X11) |
| 90 SetGpuX11ErrorHandlers(); | 90 SetGpuX11ErrorHandlers(); |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 // On Linux the GpuThread constructor performs certain |
| 94 // initialization that is required before accessing the default X |
| 95 // display. |
| 96 GpuProcess gpu_process; |
| 97 GpuThread* gpu_thread = new GpuThread; |
| 98 gpu_process.set_main_thread(gpu_thread); |
| 99 |
| 93 // Load the GL implementation and locate the bindings before starting as | 100 // Load the GL implementation and locate the bindings before starting as |
| 94 // this can take a lot of time and the GPU watchdog might terminate the GPU | 101 // this can take a lot of time and the GPU watchdog might terminate the GPU |
| 95 // process. | 102 // process. |
| 96 if (!gfx::GLContext::InitializeOneOff()) | 103 if (!gfx::GLContext::InitializeOneOff()) |
| 97 return EXIT_FAILURE; | 104 return EXIT_FAILURE; |
| 98 | 105 |
| 99 GpuProcess gpu_process; | |
| 100 GpuThread* gpu_thread = new GpuThread; | |
| 101 gpu_process.set_main_thread(gpu_thread); | |
| 102 | |
| 103 // Only enable this experimental feaure for a subset of users. | 106 // Only enable this experimental feaure for a subset of users. |
| 104 scoped_refptr<base::FieldTrial> watchdog_trial( | 107 scoped_refptr<base::FieldTrial> watchdog_trial( |
| 105 new base::FieldTrial("GpuWatchdogTrial", 100)); | 108 new base::FieldTrial("GpuWatchdogTrial", 100)); |
| 106 int watchdog_timeout = 0; | 109 int watchdog_timeout = 0; |
| 107 for (int i = kMinGpuTimeout; i <= kMaxGpuTimeout; ++i) { | 110 for (int i = kMinGpuTimeout; i <= kMaxGpuTimeout; ++i) { |
| 108 int group = watchdog_trial->AppendGroup(StringPrintf("%dsecs", i), | 111 int group = watchdog_trial->AppendGroup(StringPrintf("%dsecs", i), |
| 109 kFieldTrialSize); | 112 kFieldTrialSize); |
| 110 if (group == watchdog_trial->group()) { | 113 if (group == watchdog_trial->group()) { |
| 111 watchdog_timeout = i; | 114 watchdog_timeout = i; |
| 112 break; | 115 break; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // initialization time is recorded in the GPU info. | 152 // initialization time is recorded in the GPU info. |
| 150 gpu_thread->Init(start_time); | 153 gpu_thread->Init(start_time); |
| 151 | 154 |
| 152 main_message_loop.Run(); | 155 main_message_loop.Run(); |
| 153 | 156 |
| 154 if (enable_watchdog) | 157 if (enable_watchdog) |
| 155 watchdog_thread->Stop(); | 158 watchdog_thread->Stop(); |
| 156 | 159 |
| 157 return 0; | 160 return 0; |
| 158 } | 161 } |
| OLD | NEW |