#include "browser/api/atom_api_window.h"
+#include "base/process_util.h"
#include "base/values.h"
#include "browser/native_window.h"
#include "common/v8_conversions.h"
v8::Handle<v8::Value> Window::Destroy(const v8::Arguments &args) {
UNWRAP_WINDOW_AND_CHECK;
+ base::ProcessHandle handle = self->window_->GetRenderProcessHandle();
delete self;
+ // Check if the render process is terminated, it could happen that the render
+ // became a zombie.
+ if (!base::WaitForSingleProcess(handle,
+ base::TimeDelta::FromMilliseconds(500)))
+ base::KillProcess(handle, 0, true);
+
return v8::Undefined();
}
return true;
}
+base::ProcessHandle NativeWindow::GetRenderProcessHandle() {
+ return GetWebContents()->GetRenderProcessHost()->GetHandle();
+}
+
void NativeWindow::CapturePage(const gfx::Rect& rect,
const CapturePageCallback& callback) {
GetWebContents()->GetRenderViewHost()->CopyFromBackingStore(
virtual void RestartHangMonitorTimeout();
virtual bool SetIcon(const std::string& path);
+ // Returns the process handle of render process, useful for killing the
+ // render process manually
+ virtual base::ProcessHandle GetRenderProcessHandle();
+
// Captures the page with |rect|, |callback| would be called when capturing is
// done.
virtual void CapturePage(const gfx::Rect& rect,