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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/chrome_frame_automation_provider.h" 5 #include "chrome/browser/automation/chrome_frame_automation_provider.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/common/automation_messages.h" 9 #include "chrome/common/automation_messages.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
11 #include "ipc/ipc_channel.h" 11 #include "ipc/ipc_channel.h"
12 12
13
14 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
15
13 ChromeFrameAutomationProvider::ChromeFrameAutomationProvider(Profile* profile) 16 ChromeFrameAutomationProvider::ChromeFrameAutomationProvider(Profile* profile)
14 : AutomationProvider(profile) { 17 : AutomationProvider(profile) {
15 DCHECK(g_browser_process); 18 DCHECK(g_browser_process);
16 if (g_browser_process) 19 if (g_browser_process)
17 g_browser_process->AddRefModule(); 20 g_browser_process->AddRefModule();
18 } 21 }
19 22
20 ChromeFrameAutomationProvider::~ChromeFrameAutomationProvider() { 23 ChromeFrameAutomationProvider::~ChromeFrameAutomationProvider() {
21 DCHECK(g_browser_process); 24 DCHECK(g_browser_process);
22 if (g_browser_process) 25 if (g_browser_process) {
23 g_browser_process->ReleaseModule(); 26 // We have Chrome Frame defer Chrome shutdown for a time to improve
27 // intra-page load times.
28 MessageLoop::current()->PostDelayedTask(
29 FROM_HERE,
30 base::Bind(&ChromeFrameAutomationProvider::ReleaseBrowserProcess),
31 base::TimeDelta::FromSeconds(kShutdownDelaySeconds));
32 }
24 } 33 }
25 34
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.
35
26 bool ChromeFrameAutomationProvider::OnMessageReceived( 36 bool ChromeFrameAutomationProvider::OnMessageReceived(
27 const IPC::Message& message) { 37 const IPC::Message& message) {
28 if (IsValidMessage(message.type())) 38 if (IsValidMessage(message.type()))
29 return AutomationProvider::OnMessageReceived(message); 39 return AutomationProvider::OnMessageReceived(message);
30 40
31 OnUnhandledMessage(message); 41 OnUnhandledMessage(message);
32 return false; 42 return false;
33 } 43 }
34 44
35 void ChromeFrameAutomationProvider::OnUnhandledMessage( 45 void ChromeFrameAutomationProvider::OnUnhandledMessage(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 is_valid_message = true; 89 is_valid_message = true;
80 break; 90 break;
81 } 91 }
82 92
83 default: 93 default:
84 break; 94 break;
85 } 95 }
86 96
87 return is_valid_message; 97 return is_valid_message;
88 } 98 }
99
100 // static
101 void ChromeFrameAutomationProvider::ReleaseBrowserProcess() {
102 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.
103 g_browser_process->ReleaseModule();
104 }
105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698