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

Side by Side Diff: chrome/browser/browser_shutdown.cc

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_shutdown.h" 5 #include "chrome/browser/browser_shutdown.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/thread.h" 13 #include "base/thread.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/waitable_event.h" 15 #include "base/waitable_event.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chrome_thread.h"
17 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 18 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
18 #include "chrome/browser/first_run.h" 19 #include "chrome/browser/first_run.h"
19 #include "chrome/browser/jankometer.h" 20 #include "chrome/browser/jankometer.h"
20 #include "chrome/browser/metrics/metrics_service.h" 21 #include "chrome/browser/metrics/metrics_service.h"
21 #include "chrome/browser/plugin_process_host.h" 22 #include "chrome/browser/plugin_process_host.h"
22 #include "chrome/browser/renderer_host/render_process_host.h" 23 #include "chrome/browser/renderer_host/render_process_host.h"
23 #include "chrome/browser/renderer_host/render_view_host.h" 24 #include "chrome/browser/renderer_host/render_view_host.h"
24 #include "chrome/browser/renderer_host/render_widget_host.h" 25 #include "chrome/browser/renderer_host/render_widget_host.h"
25 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #if defined(OS_WIN) 84 #if defined(OS_WIN)
84 FilePath GetShutdownMsPath() { 85 FilePath GetShutdownMsPath() {
85 FilePath shutdown_ms_file; 86 FilePath shutdown_ms_file;
86 PathService::Get(base::DIR_TEMP, &shutdown_ms_file); 87 PathService::Get(base::DIR_TEMP, &shutdown_ms_file);
87 return shutdown_ms_file.AppendASCII(kShutdownMsFile); 88 return shutdown_ms_file.AppendASCII(kShutdownMsFile);
88 } 89 }
89 #endif 90 #endif
90 91
91 void Shutdown() { 92 void Shutdown() {
92 // Unload plugins. This needs to happen on the IO thread. 93 // Unload plugins. This needs to happen on the IO thread.
93 if (g_browser_process->io_thread()) { 94 ChromeThread::PostTask(
94 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 95 ChromeThread::IO, FROM_HERE,
95 NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins)); 96 NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins));
96 }
97 97
98 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough 98 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough
99 // time to get here. If you have something that *must* happen on end session, 99 // time to get here. If you have something that *must* happen on end session,
100 // consider putting it in BrowserProcessImpl::EndSession. 100 // consider putting it in BrowserProcessImpl::EndSession.
101 DCHECK(g_browser_process); 101 DCHECK(g_browser_process);
102 102
103 // Notifies we are going away. 103 // Notifies we are going away.
104 g_browser_process->shutdown_event()->Signal(); 104 g_browser_process->shutdown_event()->Signal();
105 105
106 PrefService* prefs = g_browser_process->local_state(); 106 PrefService* prefs = g_browser_process->local_state();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 UMA_HISTOGRAM_TIMES(time_per.c_str(), 210 UMA_HISTOGRAM_TIMES(time_per.c_str(),
211 TimeDelta::FromMilliseconds(shutdown_ms / num_procs)); 211 TimeDelta::FromMilliseconds(shutdown_ms / num_procs));
212 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.total", num_procs); 212 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.total", num_procs);
213 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.slow", num_procs_slow); 213 UMA_HISTOGRAM_COUNTS_100("Shutdown.renderers.slow", num_procs_slow);
214 } 214 }
215 } 215 }
216 } 216 }
217 #endif 217 #endif
218 218
219 } // namespace browser_shutdown 219 } // namespace browser_shutdown
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698