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" | |
17 #include "base/waitable_event.h" | 16 #include "base/waitable_event.h" |
18 #include "chrome/browser/appcache/chrome_appcache_service.h" | 17 #include "chrome/browser/appcache/chrome_appcache_service.h" |
19 #include "chrome/browser/automation/automation_provider_list.h" | 18 #include "chrome/browser/automation/automation_provider_list.h" |
20 #include "chrome/browser/browser_child_process_host.h" | 19 #include "chrome/browser/browser_child_process_host.h" |
21 #include "chrome/browser/browser_list.h" | 20 #include "chrome/browser/browser_list.h" |
22 #include "chrome/browser/browser_main.h" | 21 #include "chrome/browser/browser_main.h" |
23 #include "chrome/browser/browser_process_sub_thread.h" | 22 #include "chrome/browser/browser_process_sub_thread.h" |
24 #include "chrome/browser/browser_thread.h" | 23 #include "chrome/browser/browser_thread.h" |
25 #include "chrome/browser/browser_trial.h" | 24 #include "chrome/browser/browser_trial.h" |
26 #include "chrome/browser/debugger/debugger_wrapper.h" | 25 #include "chrome/browser/debugger/debugger_wrapper.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 did_start_ = true; | 245 did_start_ = true; |
247 module_ref_count_++; | 246 module_ref_count_++; |
248 return module_ref_count_; | 247 return module_ref_count_; |
249 } | 248 } |
250 | 249 |
251 unsigned int BrowserProcessImpl::ReleaseModule() { | 250 unsigned int BrowserProcessImpl::ReleaseModule() { |
252 DCHECK(CalledOnValidThread()); | 251 DCHECK(CalledOnValidThread()); |
253 DCHECK_NE(0u, module_ref_count_); | 252 DCHECK_NE(0u, module_ref_count_); |
254 module_ref_count_--; | 253 module_ref_count_--; |
255 if (0 == module_ref_count_) { | 254 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)); | |
262 MessageLoop::current()->PostTask( | 255 MessageLoop::current()->PostTask( |
263 FROM_HERE, NewRunnableFunction(DidEndMainMessageLoop)); | 256 FROM_HERE, NewRunnableFunction(DidEndMainMessageLoop)); |
264 MessageLoop::current()->Quit(); | 257 MessageLoop::current()->Quit(); |
265 } | 258 } |
266 return module_ref_count_; | 259 return module_ref_count_; |
267 } | 260 } |
268 | 261 |
269 void BrowserProcessImpl::EndSession() { | 262 void BrowserProcessImpl::EndSession() { |
270 #if defined(OS_WIN) || defined(USE_X11) | 263 #if defined(OS_WIN) || defined(USE_X11) |
271 // Notify we are going away. | 264 // Notify we are going away. |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 } | 860 } |
868 | 861 |
869 void BrowserProcessImpl::OnAutoupdateTimer() { | 862 void BrowserProcessImpl::OnAutoupdateTimer() { |
870 if (CanAutorestartForUpdate()) { | 863 if (CanAutorestartForUpdate()) { |
871 DLOG(WARNING) << "Detected update. Restarting browser."; | 864 DLOG(WARNING) << "Detected update. Restarting browser."; |
872 RestartPersistentInstance(); | 865 RestartPersistentInstance(); |
873 } | 866 } |
874 } | 867 } |
875 | 868 |
876 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 869 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |