diff options
Diffstat (limited to 'chrome/browser/process_singleton_win.cc')
-rw-r--r-- | chrome/browser/process_singleton_win.cc | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index 190804f..af61e22 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -248,57 +248,3 @@ LRESULT CALLBACK ProcessSingleton::WndProc(HWND hwnd, UINT message, return ::DefWindowProc(hwnd, message, wparam, lparam); } - -void ProcessSingleton::HuntForZombieChromeProcesses() { - // Detecting dead renderers is simple: - // - The process is named chrome.exe. - // - The process' parent doesn't exist anymore. - // - The process doesn't have a chrome::kMessageWindowClass window. - // If these conditions hold, the process is a zombie renderer or plugin. - - // Retrieve the list of browser processes on start. This list is then used to - // detect zombie renderer process or plugin process. - class ZombieDetector : public base::ProcessFilter { - public: - ZombieDetector() { - for (HWND window = NULL;;) { - window = FindWindowEx(HWND_MESSAGE, - window, - chrome::kMessageWindowClass, - NULL); - if (!window) - break; - DWORD process = 0; - GetWindowThreadProcessId(window, &process); - if (process) - browsers_.push_back(process); - } - // We are also a browser, regardless of having the window or not. - browsers_.push_back(::GetCurrentProcessId()); - } - - virtual bool Includes(uint32 pid, uint32 parent_pid) const { - // Don't kill ourself eh. - if (GetCurrentProcessId() == pid) - return false; - - // Is this a browser? If so, ignore it. - if (std::find(browsers_.begin(), browsers_.end(), pid) != browsers_.end()) - return false; - - // Is the parent a browser? If so, ignore it. - if (std::find(browsers_.begin(), browsers_.end(), parent_pid) - != browsers_.end()) - return false; - - // The chrome process is orphan. - return true; - } - - protected: - std::vector<uint32> browsers_; - }; - - ZombieDetector zombie_detector; - base::KillProcesses(L"chrome.exe", ResultCodes::HUNG, &zombie_detector); -} |