process: add hang method

This commit is contained in:
deepak1556 2015-06-17 20:13:43 +05:30
parent ad59393641
commit 8e05fe3350
2 changed files with 10 additions and 0 deletions

View file

@ -26,6 +26,11 @@ void Crash() {
static_cast<DummyClass*>(NULL)->crash = true; static_cast<DummyClass*>(NULL)->crash = true;
} }
void Hang() {
for (;;)
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
}
// Called when there is a fatal error in V8, we just crash the process here so // Called when there is a fatal error in V8, we just crash the process here so
// we can get the stack trace. // we can get the stack trace.
void FatalErrorCallback(const char* location, const char* message) { void FatalErrorCallback(const char* location, const char* message) {
@ -54,6 +59,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
mate::Dictionary dict(isolate, process); mate::Dictionary dict(isolate, process);
dict.SetMethod("crash", &Crash); dict.SetMethod("crash", &Crash);
dict.SetMethod("hang", &Hang);
dict.SetMethod("log", &Log); dict.SetMethod("log", &Log);
dict.SetMethod("activateUvLoop", dict.SetMethod("activateUvLoop",
base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this))); base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this)));

View file

@ -7,3 +7,7 @@ upstream node:
* `process.versions['electron']` String - Version of Electron. * `process.versions['electron']` String - Version of Electron.
* `process.versions['chrome']` String - Version of Chromium. * `process.versions['chrome']` String - Version of Chromium.
* `process.resourcesPath` String - Path to JavaScript source code. * `process.resourcesPath` String - Path to JavaScript source code.
## process.hang
Causes the main thread of the current process hang.