OLD | NEW |
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_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "base/thread.h" | 15 #include "base/thread.h" |
| 16 #include "base/thread_restrictions.h" |
16 #include "base/waitable_event.h" | 17 #include "base/waitable_event.h" |
17 #include "chrome/browser/appcache/chrome_appcache_service.h" | 18 #include "chrome/browser/appcache/chrome_appcache_service.h" |
18 #include "chrome/browser/automation/automation_provider_list.h" | 19 #include "chrome/browser/automation/automation_provider_list.h" |
19 #include "chrome/browser/browser_child_process_host.h" | 20 #include "chrome/browser/browser_child_process_host.h" |
20 #include "chrome/browser/browser_list.h" | 21 #include "chrome/browser/browser_list.h" |
21 #include "chrome/browser/browser_main.h" | 22 #include "chrome/browser/browser_main.h" |
22 #include "chrome/browser/browser_process_sub_thread.h" | 23 #include "chrome/browser/browser_process_sub_thread.h" |
23 #include "chrome/browser/browser_thread.h" | 24 #include "chrome/browser/browser_thread.h" |
24 #include "chrome/browser/browser_trial.h" | 25 #include "chrome/browser/browser_trial.h" |
25 #include "chrome/browser/debugger/debugger_wrapper.h" | 26 #include "chrome/browser/debugger/debugger_wrapper.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 did_start_ = true; | 246 did_start_ = true; |
246 module_ref_count_++; | 247 module_ref_count_++; |
247 return module_ref_count_; | 248 return module_ref_count_; |
248 } | 249 } |
249 | 250 |
250 unsigned int BrowserProcessImpl::ReleaseModule() { | 251 unsigned int BrowserProcessImpl::ReleaseModule() { |
251 DCHECK(CalledOnValidThread()); | 252 DCHECK(CalledOnValidThread()); |
252 DCHECK_NE(0u, module_ref_count_); | 253 DCHECK_NE(0u, module_ref_count_); |
253 module_ref_count_--; | 254 module_ref_count_--; |
254 if (0 == module_ref_count_) { | 255 if (0 == module_ref_count_) { |
| 256 // Allow UI and IO threads to do blocking IO on shutdown, since we do a lot |
| 257 // of it on shutdown for valid reasons. |
| 258 base::ThreadRestrictions::SetIOAllowed(true); |
| 259 io_thread()->message_loop()->PostTask( |
| 260 FROM_HERE, |
| 261 NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true)); |
255 MessageLoop::current()->PostTask( | 262 MessageLoop::current()->PostTask( |
256 FROM_HERE, NewRunnableFunction(DidEndMainMessageLoop)); | 263 FROM_HERE, NewRunnableFunction(DidEndMainMessageLoop)); |
257 MessageLoop::current()->Quit(); | 264 MessageLoop::current()->Quit(); |
258 } | 265 } |
259 return module_ref_count_; | 266 return module_ref_count_; |
260 } | 267 } |
261 | 268 |
262 void BrowserProcessImpl::EndSession() { | 269 void BrowserProcessImpl::EndSession() { |
263 #if defined(OS_WIN) || defined(USE_X11) | 270 #if defined(OS_WIN) || defined(USE_X11) |
264 // Notify we are going away. | 271 // Notify we are going away. |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 867 } |
861 | 868 |
862 void BrowserProcessImpl::OnAutoupdateTimer() { | 869 void BrowserProcessImpl::OnAutoupdateTimer() { |
863 if (CanAutorestartForUpdate()) { | 870 if (CanAutorestartForUpdate()) { |
864 DLOG(WARNING) << "Detected update. Restarting browser."; | 871 DLOG(WARNING) << "Detected update. Restarting browser."; |
865 RestartPersistentInstance(); | 872 RestartPersistentInstance(); |
866 } | 873 } |
867 } | 874 } |
868 | 875 |
869 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 876 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |