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

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

Issue 4146004: ThreadRestrictions: disallow blocking IO on the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 7 #include <string>
8 8
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/thread.h" 18 #include "base/thread.h"
19 #include "base/thread_restrictions.h"
19 #include "base/time.h" 20 #include "base/time.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "chrome/browser/about_flags.h" 22 #include "chrome/browser/about_flags.h"
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/browser_thread.h" 24 #include "chrome/browser/browser_thread.h"
24 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 25 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
25 #include "chrome/browser/first_run/first_run.h" 26 #include "chrome/browser/first_run/first_run.h"
26 #include "chrome/browser/jankometer.h" 27 #include "chrome/browser/jankometer.h"
27 #include "chrome/browser/metrics/metrics_service.h" 28 #include "chrome/browser/metrics/metrics_service.h"
28 #include "chrome/browser/plugin_process_host.h" 29 #include "chrome/browser/plugin_process_host.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 94 }
94 } 95 }
95 96
96 FilePath GetShutdownMsPath() { 97 FilePath GetShutdownMsPath() {
97 FilePath shutdown_ms_file; 98 FilePath shutdown_ms_file;
98 PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); 99 PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file);
99 return shutdown_ms_file.AppendASCII(kShutdownMsFile); 100 return shutdown_ms_file.AppendASCII(kShutdownMsFile);
100 } 101 }
101 102
102 void Shutdown() { 103 void Shutdown() {
104 // During shutdown we will end up some blocking operations. But the
105 // work needs to get done and we're going to wait for them no matter
106 // what thread they're on, so don't worry about it slowing down
107 // shutdown.
108 base::ThreadRestrictions::SetIOAllowed(true);
109
103 // Unload plugins. This needs to happen on the IO thread. 110 // Unload plugins. This needs to happen on the IO thread.
104 BrowserThread::PostTask( 111 BrowserThread::PostTask(
105 BrowserThread::IO, FROM_HERE, 112 BrowserThread::IO, FROM_HERE,
106 NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins)); 113 NewRunnableFunction(&ChromePluginLib::UnloadAllPlugins));
107 114
108 // Shutdown all IPC channels to service processes. 115 // Shutdown all IPC channels to service processes.
109 ServiceProcessControlManager::instance()->Shutdown(); 116 ServiceProcessControlManager::instance()->Shutdown();
110 117
111 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough 118 // WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough
112 // time to get here. If you have something that *must* happen on end session, 119 // time to get here. If you have something that *must* happen on end session,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 307
301 bool ShuttingDownWithoutClosingBrowsers() { 308 bool ShuttingDownWithoutClosingBrowsers() {
302 #if defined(USE_X11) 309 #if defined(USE_X11)
303 if (GetShutdownType() == browser_shutdown::END_SESSION) 310 if (GetShutdownType() == browser_shutdown::END_SESSION)
304 return true; 311 return true;
305 #endif 312 #endif
306 return false; 313 return false;
307 } 314 }
308 315
309 } // namespace browser_shutdown 316 } // namespace browser_shutdown
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698