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 "gpu/ipc/service/gpu_watchdog_thread.h" | 5 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/format_macros.h" |
16 #include "base/location.h" | 17 #include "base/location.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
19 #include "base/power_monitor/power_monitor.h" | 20 #include "base/power_monitor/power_monitor.h" |
20 #include "base/process/process.h" | 21 #include "base/process/process.h" |
21 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/stringprintf.h" |
22 #include "base/threading/platform_thread.h" | 24 #include "base/threading/platform_thread.h" |
23 #include "build/build_config.h" | 25 #include "build/build_config.h" |
24 | 26 |
25 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
26 #include <windows.h> | 28 #include <windows.h> |
27 #endif | 29 #endif |
28 | 30 |
29 #if defined(USE_X11) | 31 #if defined(USE_X11) |
30 #include <X11/Xatom.h> | 32 #include <X11/Xatom.h> |
31 #include <X11/Xlib.h> | 33 #include <X11/Xlib.h> |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 400 |
399 base::Time current_time = base::Time::Now(); | 401 base::Time current_time = base::Time::Now(); |
400 base::TimeTicks current_timeticks = base::TimeTicks::Now(); | 402 base::TimeTicks current_timeticks = base::TimeTicks::Now(); |
401 base::debug::Alias(¤t_time); | 403 base::debug::Alias(¤t_time); |
402 base::debug::Alias(¤t_timeticks); | 404 base::debug::Alias(¤t_timeticks); |
403 | 405 |
404 int32_t awaiting_acknowledge = | 406 int32_t awaiting_acknowledge = |
405 base::subtle::NoBarrier_Load(&awaiting_acknowledge_); | 407 base::subtle::NoBarrier_Load(&awaiting_acknowledge_); |
406 base::debug::Alias(&awaiting_acknowledge); | 408 base::debug::Alias(&awaiting_acknowledge); |
407 | 409 |
408 LOG(ERROR) << "The GPU process hung. Terminating after " | 410 // Don't log the message to stderr in release builds because the buffer |
409 << timeout_.InMilliseconds() << " ms."; | 411 // may be full. |
| 412 std::string message = base::StringPrintf( |
| 413 "The GPU process hung. Terminating after %" PRId64 " ms.", |
| 414 timeout_.InMilliseconds()); |
| 415 logging::LogMessageHandlerFunction handler = logging::GetLogMessageHandler(); |
| 416 if (handler) |
| 417 handler(logging::LOG_ERROR, __FILE__, __LINE__, 0, message); |
| 418 DLOG(ERROR) << message; |
410 | 419 |
411 // Deliberately crash the process to create a crash dump. | 420 // Deliberately crash the process to create a crash dump. |
412 *((volatile int*)0) = 0x1337; | 421 *((volatile int*)0) = 0x1337; |
413 | 422 |
414 terminated = true; | 423 terminated = true; |
415 } | 424 } |
416 | 425 |
417 #if defined(USE_X11) | 426 #if defined(USE_X11) |
418 void GpuWatchdogThread::SetupXServer() { | 427 void GpuWatchdogThread::SetupXServer() { |
419 display_ = XOpenDisplay(NULL); | 428 display_ = XOpenDisplay(NULL); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 int tty_number; | 524 int tty_number; |
516 size_t num_res = sscanf(tty_string, "tty%d\n", &tty_number); | 525 size_t num_res = sscanf(tty_string, "tty%d\n", &tty_number); |
517 if (num_res == 1) | 526 if (num_res == 1) |
518 return tty_number; | 527 return tty_number; |
519 } | 528 } |
520 return -1; | 529 return -1; |
521 } | 530 } |
522 #endif | 531 #endif |
523 | 532 |
524 } // namespace gpu | 533 } // namespace gpu |
OLD | NEW |