Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Unified Diff: gpu/ipc/service/gpu_watchdog_thread.cc

Issue 2902383003: Don't log to stderr during GPU process watchdog timeout (Closed)
Patch Set: fix format string Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/gpu_watchdog_thread.cc
diff --git a/gpu/ipc/service/gpu_watchdog_thread.cc b/gpu/ipc/service/gpu_watchdog_thread.cc
index 23b9d71d9a3964e59fb2abef630ba3523d0b516a..4006edc693ccd92780dfc8c2bce5d0b4bbccda20 100644
--- a/gpu/ipc/service/gpu_watchdog_thread.cc
+++ b/gpu/ipc/service/gpu_watchdog_thread.cc
@@ -13,12 +13,14 @@
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
#include "base/files/file_util.h"
+#include "base/format_macros.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/power_monitor/power_monitor.h"
#include "base/process/process.h"
#include "base/single_thread_task_runner.h"
+#include "base/strings/stringprintf.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
@@ -405,8 +407,15 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
base::subtle::NoBarrier_Load(&awaiting_acknowledge_);
base::debug::Alias(&awaiting_acknowledge);
- LOG(ERROR) << "The GPU process hung. Terminating after "
- << timeout_.InMilliseconds() << " ms.";
+ // Don't log the message to stderr in release builds because the buffer
+ // may be full.
+ std::string message = base::StringPrintf(
+ "The GPU process hung. Terminating after %" PRId64 " ms.",
+ timeout_.InMilliseconds());
+ logging::LogMessageHandlerFunction handler = logging::GetLogMessageHandler();
+ if (handler)
+ handler(logging::LOG_ERROR, __FILE__, __LINE__, 0, message);
+ DLOG(ERROR) << message;
// Deliberately crash the process to create a crash dump.
*((volatile int*)0) = 0x1337;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698