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

Issue 255036: Adding a SIGTERM handler for OS_POSIX builds. (Closed)

Created:
11 years, 2 months ago by Chris Masone
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, ben+cc_chromium.org, tim (not reviewing)
Visibility:
Public.

Description

Adding a SIGTERM handler for OS_POSIX builds. This is needed so that Chrome can shut down gracefully when many posix-based system halt or reboot while Chrome is open. SIGTERM may come in on any thread, so the handler creates a Task object that wraps up a call to BrowserList::CloseAllBrowsers(true) and Posts it to the message loop of the UI thread. Thus, we both get out of the signal handler quickly and can deal with the signal on any thread. BUG=23551 TEST=covered by BrowserTest.PosixSessionEnd Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=28225

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 13

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 3

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 4

Patch Set 12 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+79 lines, -11 lines) Patch
M chrome/browser/browser_main.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +25 lines, -0 lines 0 comments Download
M chrome/browser/browser_uitest.cc View 2 3 4 5 6 7 8 9 10 3 chunks +49 lines, -3 lines 0 comments Download
M chrome/test/ui/ui_test.cc View 2 3 4 5 6 7 8 2 chunks +5 lines, -8 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
Chris Masone
11 years, 2 months ago (2009-10-01 22:10:26 UTC) #1
agl
http://codereview.chromium.org/255036/diff/6002/5006 File base/process_util_posix.cc (right): http://codereview.chromium.org/255036/diff/6002/5006#newcode108 Line 108: DCHECK(process_id > 1); DCHECK_GT http://codereview.chromium.org/255036/diff/6002/5003 File chrome/browser/browser_main.cc (right): ...
11 years, 2 months ago (2009-10-01 22:20:58 UTC) #2
Chris Masone
http://codereview.chromium.org/255036/diff/6002/5006 File base/process_util_posix.cc (right): http://codereview.chromium.org/255036/diff/6002/5006#newcode108 Line 108: DCHECK(process_id > 1); On 2009/10/01 22:20:58, agl wrote: ...
11 years, 2 months ago (2009-10-01 22:32:16 UTC) #3
Paweł Hajdan Jr.
+tony (I think I had earlier discussion with you about SIGKILL and you didn't like ...
11 years, 2 months ago (2009-10-01 22:49:51 UTC) #4
agl
http://codereview.chromium.org/255036/diff/6002/5003 File chrome/browser/browser_main.cc (right): http://codereview.chromium.org/255036/diff/6002/5003#newcode165 Line 165: LOG(WARNING) << "Handling a SIGTERM for " << ...
11 years, 2 months ago (2009-10-01 22:51:01 UTC) #5
Chris Masone
On Thu, Oct 1, 2009 at 3:51 PM, <agl@chromium.org> wrote: > > http://codereview.chromium.org/255036/diff/6002/5003 > File ...
11 years, 2 months ago (2009-10-01 23:08:31 UTC) #6
tony
On 2009/10/01 22:49:51, Paweł Hajdan Jr. wrote: > +tony (I think I had earlier discussion ...
11 years, 2 months ago (2009-10-01 23:14:53 UTC) #7
Paweł Hajdan Jr.
On 2009/10/01 23:14:53, tony wrote: > On 2009/10/01 22:49:51, Paweł Hajdan Jr. wrote: > > ...
11 years, 2 months ago (2009-10-01 23:17:08 UTC) #8
Chris Masone
On Thu, Oct 1, 2009 at 4:17 PM, <phajdan.jr@chromium.org> wrote: > On 2009/10/01 23:14:53, tony ...
11 years, 2 months ago (2009-10-02 14:58:28 UTC) #9
Chris Masone
11 years, 2 months ago (2009-10-03 21:37:24 UTC) #10
Chris Masone
I've made it so that a) only the UI thread gets signals now, and b) ...
11 years, 2 months ago (2009-10-04 02:54:32 UTC) #11
Mark Mentovai
Maybe a better solution would be to let the SIGTERM handler run on any thread, ...
11 years, 2 months ago (2009-10-04 03:50:09 UTC) #12
Chris Masone
On 2009/10/04 03:50:09, Mark Mentovai wrote: > Maybe a better solution would be to let ...
11 years, 2 months ago (2009-10-04 04:08:09 UTC) #13
Chris Masone
Ok, now the signal can get handled anywhere, and it posts a task to the ...
11 years, 2 months ago (2009-10-05 23:22:26 UTC) #14
Chris Masone
The test slowness seems to be confined to my own workstation, which is good. The ...
11 years, 2 months ago (2009-10-06 03:09:21 UTC) #15
agl
LGTM
11 years, 2 months ago (2009-10-06 20:10:29 UTC) #16
Mark Mentovai
LG. This is much cleaner. http://codereview.chromium.org/255036/diff/7005/7006 File chrome/browser/browser_main.cc (right): http://codereview.chromium.org/255036/diff/7005/7006#newcode167 Line 167: if (main_loop) Minor ...
11 years, 2 months ago (2009-10-06 20:15:16 UTC) #17
Chris Masone
11 years, 2 months ago (2009-10-06 20:47:33 UTC) #18
Thanks, everyone!

I'll submit, along with everyone else in the world, when the tree is open :-)

http://codereview.chromium.org/255036/diff/7005/7006
File chrome/browser/browser_main.cc (right):

http://codereview.chromium.org/255036/diff/7005/7006#newcode167
Line 167: if (main_loop)
On 2009/10/06 20:15:17, Mark Mentovai wrote:
> Minor style nit: this needs {braces} on the conditionalized clause because it
> spans multiple lines.

Done.

http://codereview.chromium.org/255036/diff/7005/7006#newcode173
Line 173: struct sigaction term_action;
On 2009/10/06 20:15:17, Mark Mentovai wrote:
> Minor nit: you can just say |struct sigaction term_action = {0};| and that'll
> zero-fill it for you.  No need to explicitly memset.  Same thing below at your
> other sigaction call.

This doesn't seem to work, as the first member of sigaction is a union.  So,
stick with the memsets

Powered by Google App Engine
This is Rietveld 408576698