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

Issue 2866034: Refactor shutdown code to allow win/linux to run after last browser closes. (Closed)

Created:
10 years, 5 months ago by Andrew T Wilson (Slow)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, John Grabowski, Aaron Boodman, pam+watch_chromium.org, Erik does not do reviews, ben+cc_chromium.org, tfarina, brettw-cc_chromium.org, Paweł Hajdan Jr.
Base URL:
http://src.chromium.org/git/chromium.git
Visibility:
Public.

Description

Moved code that generates APP_TERMINATING notification into BrowserList so it can be used on all platforms. Updated observers (ExtensionProcessManager, BackgroundContents) to listen for APP_TERMINATING instead of listening for BROWSER_CLOSED on some platforms. APP_TERMINATING is now sent just before the main message loop exits rather than just after, but no code depends on this timing. Updated Mac code to always call BrowserList::CloseAllBrowsers() even if there are no open browsers, to ensure that APP_TERMINATING is always fired. Changed BackgroundContentsService to keep the browser process alive when there are BackgroundContents running and updated the unit tests. Renamed BrowserList::IsInPersistentMode() => WillShutdownWhenLastBrowserCloses() and AllBrowsersClosed() => AllBrowsersClosedAndAppExiting() to more precisely indicate their true functions. Exposed BrowserProcess::ModuleRefCount() so BrowserList can determine when the application is going to exit so the right notifications/callbacks can be generated. Updated background-auto-update-restart code to use new BrowserList APIs to determine whether the application is running "in the background". Added code to cancel shutdown on all plaforms if the user selects cancel in an onbeforeunload dialog. BUG=45275 TEST=RunInBackgroundTest (ui_test) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=53092

Patch Set 1 #

Total comments: 1

Patch Set 2 : More shutdown edge cases (no longer forces fast shutdown of renderers when window closes) #

Patch Set 3 : Fix infinite shutdown loop on mac and allow cancelling shutdown on win. #

Patch Set 4 : Removed KeepAlive APIs that I mistakenly left in from a previous revision. #

Patch Set 5 : Added unittest #

Patch Set 6 : Fixed compilation error on linux/mac #

Total comments: 6

Patch Set 7 : Added BrowserList::Start/End/WillKeepAlive() APIs #

Patch Set 8 : Fix to make sure incognito profiles work correctly with --keep-alive-for-test #

Total comments: 12

Patch Set 9 : Tweaks to reflect review feedback. #

Patch Set 10 : Fixed compilation error (unsigned int is now just plain int) #

Patch Set 11 : Uploaded patch that resolves merge issue #

Unified diffs Side-by-side diffs Delta from patch set Stats (+215 lines, -110 lines) Patch
M chrome/browser/app_controller_mac.mm View 1 2 3 4 5 6 7 8 9 10 3 chunks +12 lines, -17 lines 0 comments Download
M chrome/browser/automation/automation_provider.cc View 5 6 7 8 9 10 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/background_contents_service.h View 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/background_contents_service.cc View 2 3 4 5 6 7 8 7 chunks +26 lines, -12 lines 0 comments Download
M chrome/browser/background_contents_service_unittest.cc View 2 3 4 5 6 2 chunks +4 lines, -9 lines 0 comments Download
M chrome/browser/browser.cc View 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -7 lines 0 comments Download
M chrome/browser/browser_init.cc View 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/browser_list.h View 2 3 4 5 6 7 8 3 chunks +19 lines, -4 lines 0 comments Download
M chrome/browser/browser_list.cc View 1 2 3 4 5 6 7 8 9 4 chunks +57 lines, -8 lines 0 comments Download
M chrome/browser/browser_list_gtk.cc View 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_list_mac.mm View 2 1 chunk +3 lines, -4 lines 0 comments Download
M chrome/browser/browser_list_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_main_mac.mm View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/browser_process_impl.cc View 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/browser_shutdown.h View 1 2 3 1 chunk +15 lines, -10 lines 0 comments Download
M chrome/browser/browser_shutdown.cc View 1 2 3 4 5 6 7 8 9 3 chunks +0 lines, -4 lines 0 comments Download
M chrome/browser/browser_uitest.cc View 5 6 7 1 chunk +26 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_process_manager.cc View 2 chunks +2 lines, -15 lines 0 comments Download
M chrome/browser/js_modal_dialog.cc View 3 4 5 6 7 8 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/profile_manager.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/background_contents.cc View 2 chunks +8 lines, -2 lines 0 comments Download
M chrome/common/chrome_switches.h View 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/common/notification_type.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +12 lines, -6 lines 0 comments Download
M chrome/test/testing_browser_process.h View 2 3 4 5 6 1 chunk +0 lines, -4 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
tfarina
http://codereview.chromium.org/2866034/diff/1/3 File chrome/browser/browser_list.cc (right): http://codereview.chromium.org/2866034/diff/1/3#newcode234 chrome/browser/browser_list.cc:234: if (!BrowserList::size()) { Instead of this, could you add ...
10 years, 5 months ago (2010-06-30 02:38:13 UTC) #1
Andrew T Wilson (Slow)
This is ready for review, so please take a look - if there's someone else ...
10 years, 5 months ago (2010-07-13 15:38:59 UTC) #2
sky
http://codereview.chromium.org/2866034/diff/15001/16008 File chrome/browser/browser_list.cc (right): http://codereview.chromium.org/2866034/diff/15001/16008#newcode339 chrome/browser/browser_list.cc:339: return g_browser_process->ModuleRefCount() == ref_count; I don't think it's right ...
10 years, 5 months ago (2010-07-13 16:10:13 UTC) #3
Paweł Hajdan Jr.
Drive-by with some automation comments. http://codereview.chromium.org/2866034/diff/15001/16002 File chrome/browser/automation/automation_provider.cc (right): http://codereview.chromium.org/2866034/diff/15001/16002#newcode171 chrome/browser/automation/automation_provider.cc:171: DLOG(WARNING) << "SHUTTING DOWN ...
10 years, 5 months ago (2010-07-13 16:24:06 UTC) #4
Andrew T Wilson (Slow)
http://codereview.chromium.org/2866034/diff/15001/16008 File chrome/browser/browser_list.cc (right): http://codereview.chromium.org/2866034/diff/15001/16008#newcode339 chrome/browser/browser_list.cc:339: return g_browser_process->ModuleRefCount() == ref_count; On 2010/07/13 16:10:14, sky wrote: ...
10 years, 5 months ago (2010-07-14 01:39:49 UTC) #5
Andrew T Wilson (Slow)
Please take another look. There is a trybot failure on linux, because this CL is ...
10 years, 5 months ago (2010-07-17 17:02:16 UTC) #6
sky
Mostly just nits. But two additional comments/questions: . Did you make sure everything works ok ...
10 years, 5 months ago (2010-07-19 16:10:08 UTC) #7
Paweł Hajdan Jr.
Code I commented in the drive-by LGTM.
10 years, 5 months ago (2010-07-19 19:14:51 UTC) #8
Andrew T Wilson (Slow)
OK, addressed your comments (see below for some clarifications). Please take another look. Session restore ...
10 years, 5 months ago (2010-07-19 20:59:51 UTC) #9
sky
10 years, 5 months ago (2010-07-19 21:17:44 UTC) #10
LGTM

Powered by Google App Engine
This is Rietveld 408576698