diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 17:40:49 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 17:40:49 +0000 |
commit | c1275ae20c3e2c712d777de04340a671c8aabb94 (patch) | |
tree | e4bd55fc3de1c9fdf16f270a3c4dfdae5b7d904a | |
parent | 1c57b7b3f5bfe15eeea1fb9023a86b30cba5a2be (diff) | |
download | chromium_src-c1275ae20c3e2c712d777de04340a671c8aabb94.zip chromium_src-c1275ae20c3e2c712d777de04340a671c8aabb94.tar.gz chromium_src-c1275ae20c3e2c712d777de04340a671c8aabb94.tar.bz2 |
Posix: Stop crashing on SIG{INT|HUP|TERM}.
BUG=48637
Review URL: http://codereview.chromium.org/2927008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52098 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_main.h | 12 | ||||
-rw-r--r-- | chrome/browser/browser_main_posix.cc | 36 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.cc | 2 |
3 files changed, 25 insertions, 25 deletions
diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index d23a7e5..2403e28 100644 --- a/chrome/browser/browser_main.h +++ b/chrome/browser/browser_main.h @@ -48,16 +48,11 @@ class BrowserMainParts { // later than "EarlyInitialization()" but dependent on it. Once the // refactoring includes that later stage, this should be put in some more // generic platform-dependent method. - void TemporaryPosix_1() {} + virtual void TemporaryPosix_1() {} protected: explicit BrowserMainParts(const MainFunctionParams& parameters); - // Methods to be overridden to provide platform-specific code; these - // correspond to the "parts" above. - virtual void PreEarlyInitialization() {} - virtual void PostEarlyInitialization() {} - // Accessors for data members (below) ---------------------------------------- const MainFunctionParams& parameters() const { return parameters_; @@ -67,6 +62,11 @@ class BrowserMainParts { } private: + // Methods to be overridden to provide platform-specific code; these + // correspond to the "parts" above. + virtual void PreEarlyInitialization() {} + virtual void PostEarlyInitialization() {} + // Methods for |EarlyInitialization()| --------------------------------------- // A/B test for the maximum number of persistent connections per host. diff --git a/chrome/browser/browser_main_posix.cc b/chrome/browser/browser_main_posix.cc index f9a5df2..d85a93f 100644 --- a/chrome/browser/browser_main_posix.cc +++ b/chrome/browser/browser_main_posix.cc @@ -158,7 +158,24 @@ class BrowserMainPartsPosix : public BrowserMainParts { explicit BrowserMainPartsPosix(const MainFunctionParams& parameters) : BrowserMainParts(parameters) {} - protected: + virtual void TemporaryPosix_1() { + int pipefd[2]; + int ret = pipe(pipefd); + if (ret < 0) { + PLOG(DFATAL) << "Failed to create pipe"; + } else { + g_shutdown_pipe_read_fd = pipefd[0]; + g_shutdown_pipe_write_fd = pipefd[1]; + const size_t kShutdownDetectorThreadStackSize = 4096; + if (!PlatformThread::CreateNonJoinable( + kShutdownDetectorThreadStackSize, + new ShutdownDetector(g_shutdown_pipe_read_fd))) { + LOG(DFATAL) << "Failed to create shutdown detector task."; + } + } + } + + private: virtual void PreEarlyInitialization() { // We need to accept SIGCHLD, even though our handler is a no-op because // otherwise we cannot wait on children. (According to POSIX 2001.) @@ -202,23 +219,6 @@ class BrowserMainPartsPosix : public BrowserMainParts { if (fd_limit > 0) SetFileDescriptorLimit(fd_limit); } - - void TemporaryPosix_1() { - int pipefd[2]; - int ret = pipe(pipefd); - if (ret < 0) { - PLOG(DFATAL) << "Failed to create pipe"; - } else { - g_shutdown_pipe_read_fd = pipefd[0]; - g_shutdown_pipe_write_fd = pipefd[1]; - const size_t kShutdownDetectorThreadStackSize = 4096; - if (!PlatformThread::CreateNonJoinable( - kShutdownDetectorThreadStackSize, - new ShutdownDetector(g_shutdown_pipe_read_fd))) { - LOG(DFATAL) << "Failed to create shutdown detector task."; - } - } - } }; // static diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index fdfb413..588a76c 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -211,7 +211,7 @@ class BrowserMainPartsWin : public BrowserMainParts { explicit BrowserMainPartsWin(const MainFunctionParams& parameters) : BrowserMainParts(parameters) {} - protected: + private: virtual void PreEarlyInitialization() { // Initialize Winsock. net::EnsureWinsockInit(); |