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

Unified Diff: content/gpu/gpu_watchdog_thread.cc

Issue 7646031: GPU process terminates rather than crashing on hang. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « content/gpu/gpu_watchdog_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_watchdog_thread.cc
===================================================================
--- content/gpu/gpu_watchdog_thread.cc (revision 96238)
+++ content/gpu/gpu_watchdog_thread.cc (working copy)
@@ -9,7 +9,10 @@
#include "content/gpu/gpu_watchdog_thread.h"
#include "base/compiler_specific.h"
+#include "base/process.h"
+#include "base/process_util.h"
#include "build/build_config.h"
+#include "content/common/result_codes.h"
namespace {
const int64 kCheckPeriod = 2000;
@@ -186,12 +189,12 @@
message_loop()->PostDelayedTask(
FROM_HERE,
method_factory_->NewRunnableMethod(
- &GpuWatchdogThread::DeliberatelyCrashingToRecoverFromHang),
+ &GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang),
timeout_);
}
// Use the --disable-gpu-watchdog command line switch to disable this.
-void GpuWatchdogThread::DeliberatelyCrashingToRecoverFromHang() {
+void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
#if defined(OS_WIN)
// Defer termination until a certain amount of CPU time has elapsed on the
// watched thread.
@@ -200,7 +203,7 @@
message_loop()->PostDelayedTask(
FROM_HERE,
method_factory_->NewRunnableMethod(
- &GpuWatchdogThread::DeliberatelyCrashingToRecoverFromHang),
+ &GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang),
timeout_ - time_since_arm);
return;
}
@@ -217,12 +220,11 @@
return;
}
- // Make sure the timeout period is on the stack before crashing.
- volatile int timeout = timeout_;
-
- // For minimal developer annoyance, don't keep crashing.
- static bool crashed = false;
- if (crashed)
+ // For minimal developer annoyance, don't keep terminating. You need to skip
+ // the call to base::Process::Terminate below in a debugger for this to be
+ // useful.
+ static bool terminated = false;
+ if (terminated)
return;
#if defined(OS_WIN)
@@ -233,8 +235,8 @@
LOG(ERROR) << "The GPU process hung. Terminating after "
<< timeout_ << " ms.";
- volatile int* null_pointer = NULL;
- *null_pointer = timeout;
+ base::Process current_process(base::GetCurrentProcessHandle());
+ current_process.Terminate(content::RESULT_CODE_HUNG);
- crashed = true;
+ terminated = true;
}
« no previous file with comments | « content/gpu/gpu_watchdog_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698