| 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 "chrome/gpu/gpu_thread.h" | 5 #include "chrome/gpu/gpu_thread.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/gfx/gl/gl_context.h" | 10 #include "app/gfx/gl/gl_context.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 #endif | 123 #endif |
| 124 | 124 |
| 125 void GpuThread::OnCrash() { | 125 void GpuThread::OnCrash() { |
| 126 // Good bye, cruel world. | 126 // Good bye, cruel world. |
| 127 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; | 127 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; |
| 128 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; | 128 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; |
| 129 } | 129 } |
| 130 | 130 |
| 131 void GpuThread::OnHang() { | 131 void GpuThread::OnHang() { |
| 132 for (;;) | 132 for (;;) { |
| 133 PlatformThread::Sleep(1000); | 133 // Do not sleep here. The GPU watchdog timer tracks the amount of user |
| 134 // time this thread is using and it doesn't use much while calling Sleep. |
| 135 } |
| 134 } | 136 } |
| 135 | 137 |
| 136 #if defined(OS_WIN) | 138 #if defined(OS_WIN) |
| 137 | 139 |
| 138 // Runs on a worker thread. The GpuThread never terminates voluntarily so it is | 140 // Runs on a worker thread. The GpuThread never terminates voluntarily so it is |
| 139 // safe to assume that its message loop is valid. | 141 // safe to assume that its message loop is valid. |
| 140 void GpuThread::CollectDxDiagnostics(GpuThread* thread) { | 142 void GpuThread::CollectDxDiagnostics(GpuThread* thread) { |
| 141 win_util::ScopedCOMInitializer com_initializer; | 143 win_util::ScopedCOMInitializer com_initializer; |
| 142 | 144 |
| 143 DxDiagNode node; | 145 DxDiagNode node; |
| 144 gpu_info_collector::GetDxDiagnostics(&node); | 146 gpu_info_collector::GetDxDiagnostics(&node); |
| 145 | 147 |
| 146 thread->message_loop()->PostTask( | 148 thread->message_loop()->PostTask( |
| 147 FROM_HERE, | 149 FROM_HERE, |
| 148 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); | 150 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); |
| 149 } | 151 } |
| 150 | 152 |
| 151 // Runs on the GPU thread. | 153 // Runs on the GPU thread. |
| 152 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 154 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
| 153 thread->gpu_info_.SetDxDiagnostics(node); | 155 thread->gpu_info_.SetDxDiagnostics(node); |
| 154 thread->gpu_info_.SetProgress(GPUInfo::kComplete); | 156 thread->gpu_info_.SetProgress(GPUInfo::kComplete); |
| 155 } | 157 } |
| 156 | 158 |
| 157 #endif | 159 #endif |
| OLD | NEW |