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

Issue 1520006: Mac: reform our shutdown routine. (Closed)

Created:
10 years, 8 months ago by viettrungluu
Modified:
9 years, 6 months ago
CC:
chromium-reviews, John Grabowski, pam+watch_chromium.org, ben+cc_chromium.org
Visibility:
Public.

Description

Mac: reform our shutdown routine. Make shutdown be more like other platforms. Moreover: - Cancelling quit from an onbeforeunload dialog shouldn't mess up the browser. - Having quit cancelled due to a window pop up on the closure of another window shouldn't break the browser. [With this patch, it will result in the browser being in a quirky state in which the closure of the last browser window will cause a quit. But the browser won't be broken.] BUG=34384, 37813, 37927 TEST=See bugs. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=44096

Patch Set 1 #

Patch Set 2 : merged ToT #

Patch Set 3 : Oops. I should remember all the files. #

Total comments: 20

Patch Set 4 : Mostly cleaned up. #

Patch Set 5 : filed bug and added bug number to TODO #

Total comments: 4

Patch Set 6 : changed comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+217 lines, -71 lines) Patch
M chrome/browser/app_controller_mac.h View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/browser/app_controller_mac.mm View 1 2 3 4 6 chunks +61 lines, -16 lines 0 comments Download
M chrome/browser/browser.cc View 1 2 3 1 chunk +9 lines, -5 lines 0 comments Download
M chrome/browser/browser_list.cc View 1 chunk +2 lines, -2 lines 0 comments Download
A chrome/browser/browser_list_mac.mm View 1 chunk +15 lines, -0 lines 0 comments Download
M chrome/browser/browser_shutdown.h View 1 2 3 1 chunk +16 lines, -0 lines 0 comments Download
M chrome/browser/browser_shutdown.cc View 1 2 3 2 chunks +15 lines, -0 lines 0 comments Download
M chrome/browser/chrome_browser_application_mac.h View 1 2 3 3 chunks +8 lines, -1 line 0 comments Download
M chrome/browser/chrome_browser_application_mac.mm View 1 2 3 4 chunks +76 lines, -47 lines 0 comments Download
M chrome/browser/js_modal_dialog_mac.mm View 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
viettrungluu
10 years, 8 months ago (2010-03-30 22:51:59 UTC) #1
Mark Mentovai
The trybot failed unit_tests. Can you check to see if it’s because of the patch ...
10 years, 8 months ago (2010-03-31 19:51:57 UTC) #2
viettrungluu
On 2010/03/31 19:51:57, Mark Mentovai wrote: > The trybot failed unit_tests. Can you check to ...
10 years, 8 months ago (2010-04-01 15:59:10 UTC) #3
Scott Hess - ex-Googler
http://codereview.chromium.org/1520006/diff/6001/4004 File chrome/browser/app_controller_mac.mm (right): http://codereview.chromium.org/1520006/diff/6001/4004#newcode845 chrome/browser/app_controller_mac.mm:845: withReply:(NSAppleEventDescriptor*)reply { [NSApp terminate:nil]; } Make it all pretty, ...
10 years, 8 months ago (2010-04-01 21:54:13 UTC) #4
pink (ping after 24hrs)
All the "cancel terminate" work is nice, but it still gets us into a situation ...
10 years, 8 months ago (2010-04-05 15:06:27 UTC) #5
viettrungluu
+rohitrao since he was also looking at this. I haven't had time to work on ...
10 years, 8 months ago (2010-04-07 16:30:31 UTC) #6
pink (ping after 24hrs)
I said this on IRC, but i'll echo it here for others. This is a ...
10 years, 8 months ago (2010-04-07 17:56:09 UTC) #7
viettrungluu
I think I've addressed all the comments. The Mac unit test problems were due to ...
10 years, 8 months ago (2010-04-08 22:29:30 UTC) #8
Scott Hess - ex-Googler
10 years, 8 months ago (2010-04-08 22:59:24 UTC) #9
LGTM, with minor nits.  I'm tired and grumpy and while this is a convoluted
problem, it feels like we could drop some indirection without any loss.

http://codereview.chromium.org/1520006/diff/23001/24001
File chrome/browser/app_controller_mac.h (right):

http://codereview.chromium.org/1520006/diff/23001/24001#newcode60
chrome/browser/app_controller_mac.h:60: // and if that succeeds then quit.
<channel pedantic reviewer> "Try to terminate the application" and
-tryToTerminateApplication: sound eerily similar.  Feel free to snip the first
sentence of this comment (and the comment below), and lose "That is, ".

No need to alphabetize them, though :-).

http://codereview.chromium.org/1520006/diff/23001/24002
File chrome/browser/app_controller_mac.mm (right):

http://codereview.chromium.org/1520006/diff/23001/24002#newcode239
chrome/browser/app_controller_mac.mm:239: NOTREACHED();
Non-blocking suggestion: I think you should consider a CHECK() here, because if
this is going wrong, how will we ever know?  Alternately, you could drop a
histogram in, and only add the CHECK() if it's not happening that much.

Would there be any real downside to calling -tryToTerminateApplication: and
returning NSTerminateCancel.

http://codereview.chromium.org/1520006/diff/23001/24002#newcode846
chrome/browser/app_controller_mac.mm:846:
withReply:(NSAppleEventDescriptor*)reply {
Does the calling client block until they get a reply?

http://codereview.chromium.org/1520006/diff/23001/24010
File chrome/browser/js_modal_dialog_mac.mm (right):

http://codereview.chromium.org/1520006/diff/23001/24010#newcode76
chrome/browser/js_modal_dialog_mac.mm:76: 
CancelTerminate() exists to forward to -cancelTerminate: which forwards to
-stopTryingToTerminate: which calls IsTryingToQuit() which calls
SetTryingToQuit().

I can't see anyone else calling that.  WDYT of just having this code like:
  if (bridge->is_before_unload_dialog())
    browser_shutdown::SetTryingToQuit(false);
and getting rid of all the other stuff.

Powered by Google App Engine
This is Rietveld 408576698