summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_process_impl.h
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 20:32:42 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 20:32:42 +0000
commitbd48c2b0bdcbb600bd428229c54cbefec46c5014 (patch)
tree5a10c86f0ef18bfd868578e87a1a6a9f72c7fe37 /chrome/browser/browser_process_impl.h
parent6e361384bf6ed0307eb353ce0c039049eb1efb07 (diff)
downloadchromium_src-bd48c2b0bdcbb600bd428229c54cbefec46c5014.zip
chromium_src-bd48c2b0bdcbb600bd428229c54cbefec46c5014.tar.gz
chromium_src-bd48c2b0bdcbb600bd428229c54cbefec46c5014.tar.bz2
Auto restart when update available while running in the background on windows.
Landing on behalf of dbelenko@google.com. This is a new version of the older patch. Main changes include: 1. Rebased to a never Git revision to make things easier to land. 2. Chrome will now preserve the command line switches except for those that are blacklisted. 3. Fixed a race condition that would cause the browser to think it didn't exit cleanly after it's been restarted. 4. Fixed minor nits and omissions (indentation, etc). This patch adds a timer which fires every 6 hours and checks whether the browser is in the "persistent" (background) mode, and whether there's an update pending restart. If both conditions are true, the browser is restarted with blacklisted command line keys and all loose values stripped. In order to restart the browser in the background mode, the --long-lived-extensions key is also added to the command line. This change is Windows-only, and it won't become fully functional until Drew (atwilson) checks in his work that enables Chrome to go into background. Additionally, this addresses an issue where a restarted browser might load its profile data before the previous browser process exited - we now load the profile data *after* trying to contact the other browser. This exposed a race condition in SessionRestoreUITest.RestoreAfterClosingTabbedBrowserWithAppAndLaunching, so we disabled that test and logged http://crbug.com/40946. BUG=40975,40946 Review URL: http://codereview.chromium.org/1618012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_process_impl.h')
-rw-r--r--chrome/browser/browser_process_impl.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index d6d870b..93e6ab3 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -15,6 +15,7 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
#include "base/non_thread_safe.h"
+#include "base/timer.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/browser_process.h"
@@ -194,6 +195,10 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
virtual void CheckForInspectorFiles();
+#if defined(OS_WIN)
+ void StartAutoupdateTimer();
+#endif // OS_WIN
+
virtual bool have_inspector_files() const {
return have_inspector_files_;
}
@@ -309,6 +314,16 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
// Our best estimate about the existence of the inspector directory.
bool have_inspector_files_;
+#if defined(OS_WIN)
+ base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_;
+
+ // Gets called by autoupdate timer to see if browser needs restart and can be
+ // restarted, and if that's the case, restarts the browser.
+ void OnAutoupdateTimer();
+ bool CanAutorestartForUpdate() const;
+ void RestartPersistentInstance();
+#endif // OS_WIN
+
DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
};