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

Unified Diff: chrome/browser/automation/chrome_frame_automation_provider.cc

Issue 9570017: Defer shutting down Chrome after the CF automation connection goes away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/chrome_frame_automation_provider.cc
diff --git a/chrome/browser/automation/chrome_frame_automation_provider.cc b/chrome/browser/automation/chrome_frame_automation_provider.cc
index ce2f6a42d095bb7cad8534ab2d900338073a8ffc..bb075ef9030431ff3c4c34f062e0d0b2df5c3a2f 100644
--- a/chrome/browser/automation/chrome_frame_automation_provider.cc
+++ b/chrome/browser/automation/chrome_frame_automation_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,9 @@
#include "ipc/ipc_message.h"
#include "ipc/ipc_channel.h"
+
+const int kShutdownDelaySeconds = 30;
slightlyoff 2012/03/01 16:57:12 Would be great to make this controllable from the
robertshield 2012/03/02 15:17:17 True, but this runs on the UI thread which (I thin
+
ChromeFrameAutomationProvider::ChromeFrameAutomationProvider(Profile* profile)
: AutomationProvider(profile) {
DCHECK(g_browser_process);
@@ -19,10 +22,17 @@ ChromeFrameAutomationProvider::ChromeFrameAutomationProvider(Profile* profile)
ChromeFrameAutomationProvider::~ChromeFrameAutomationProvider() {
DCHECK(g_browser_process);
- if (g_browser_process)
- g_browser_process->ReleaseModule();
+ if (g_browser_process) {
+ // We have Chrome Frame defer Chrome shutdown for a time to improve
+ // intra-page load times.
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&ChromeFrameAutomationProvider::ReleaseBrowserProcess),
+ base::TimeDelta::FromSeconds(kShutdownDelaySeconds));
+ }
}
slightlyoff 2012/03/01 16:57:12 extra newline?
grt (UTC plus 2) 2012/03/01 16:59:31 remove extra newline
robertshield 2012/03/02 15:17:17 Done.
robertshield 2012/03/02 15:17:17 Done.
+
bool ChromeFrameAutomationProvider::OnMessageReceived(
const IPC::Message& message) {
if (IsValidMessage(message.type()))
@@ -86,3 +96,10 @@ bool ChromeFrameAutomationProvider::IsValidMessage(uint32 type) {
return is_valid_message;
}
+
+// static
+void ChromeFrameAutomationProvider::ReleaseBrowserProcess() {
+ if (g_browser_process) {
grt (UTC plus 2) 2012/03/01 16:59:31 remove extra braces
robertshield 2012/03/02 15:17:17 Done.
+ g_browser_process->ReleaseModule();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698