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

Unified Diff: chrome/chrome_watcher/chrome_watcher_main.cc

Issue 2737263004: Ensure chrome watcher exits cleanly on unexpected errors (Closed)
Patch Set: Created 3 years, 9 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: chrome/chrome_watcher/chrome_watcher_main.cc
diff --git a/chrome/chrome_watcher/chrome_watcher_main.cc b/chrome/chrome_watcher/chrome_watcher_main.cc
index e0b2343716d74ad9205a1c202c1c94800ed5d519..b958a889989c889fe9d3c671cf735aa36b10d753 100644
--- a/chrome/chrome_watcher/chrome_watcher_main.cc
+++ b/chrome/chrome_watcher/chrome_watcher_main.cc
@@ -18,6 +18,7 @@
#include "base/logging_win.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/process/memory.h"
#include "base/process/process.h"
#include "base/run_loop.h"
#include "base/sequenced_task_runner.h"
@@ -31,6 +32,7 @@
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
+#include "base/win/process_startup_helper.h"
#include "base/win/scoped_handle.h"
#include "base/win/win_util.h"
#include "chrome/chrome_watcher/chrome_watcher_main_api.h"
@@ -202,6 +204,13 @@ extern "C" int WatcherMain(const base::char16* registry_path,
// chrome.exe in order to report its exit status.
::SetProcessShutdownParameters(0x100, SHUTDOWN_NORETRY);
+ // Make sure the process exits cleanly on unexpected errors.
+ base::EnableTerminationOnHeapCorruption();
+ base::EnableTerminationOnOutOfMemory();
+ base::win::RegisterInvalidParamHandler();
+ const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
+ base::win::SetupCRT(cmd_line);
+
// Run a UI message loop on the main thread.
base::PlatformThread::SetName("WatcherMainThread");
base::MessageLoop msg_loop(base::MessageLoop::TYPE_UI);
« 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