Chromium Code Reviews| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 did_start_ = true; | 244 did_start_ = true; |
| 244 module_ref_count_++; | 245 module_ref_count_++; |
| 245 return module_ref_count_; | 246 return module_ref_count_; |
| 246 } | 247 } |
| 247 | 248 |
| 248 unsigned int BrowserProcessImpl::ReleaseModule() { | 249 unsigned int BrowserProcessImpl::ReleaseModule() { |
| 249 DCHECK(CalledOnValidThread()); | 250 DCHECK(CalledOnValidThread()); |
| 250 DCHECK_NE(0u, module_ref_count_); | 251 DCHECK_NE(0u, module_ref_count_); |
| 251 module_ref_count_--; | 252 module_ref_count_--; |
| 252 if (0 == module_ref_count_) { | 253 if (0 == module_ref_count_) { |
| 254 // Allow UI and IO threads to do blocking IO on shutdown, since we do a lot | |
| 255 // of it on shutdown for valid reasons. | |
|
Evan Martin
2010/12/10 21:43:04
Heh, I hope this is the right place for this code.
willchan no longer on Chromium
2010/12/10 21:54:28
What, you don't trust me? :) Try it for yourself
| |
| 256 base::ThreadRestrictions::SetIOAllowed(true); | |
| 257 io_thread()->message_loop()->PostTask( | |
| 258 FROM_HERE, | |
| 259 NewRunnableFunction(&base::ThreadRestrictions::SetIOAllowed, true)); | |
| 253 MessageLoop::current()->PostTask( | 260 MessageLoop::current()->PostTask( |
| 254 FROM_HERE, NewRunnableFunction(DidEndMainMessageLoop)); | 261 FROM_HERE, NewRunnableFunction(DidEndMainMessageLoop)); |
| 255 MessageLoop::current()->Quit(); | 262 MessageLoop::current()->Quit(); |
| 256 } | 263 } |
| 257 return module_ref_count_; | 264 return module_ref_count_; |
| 258 } | 265 } |
| 259 | 266 |
| 260 void BrowserProcessImpl::EndSession() { | 267 void BrowserProcessImpl::EndSession() { |
| 261 #if defined(OS_WIN) || defined(USE_X11) | 268 #if defined(OS_WIN) || defined(USE_X11) |
| 262 // Notify we are going away. | 269 // Notify we are going away. |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 816 } | 823 } |
| 817 | 824 |
| 818 void BrowserProcessImpl::OnAutoupdateTimer() { | 825 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 819 if (CanAutorestartForUpdate()) { | 826 if (CanAutorestartForUpdate()) { |
| 820 DLOG(WARNING) << "Detected update. Restarting browser."; | 827 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 821 RestartPersistentInstance(); | 828 RestartPersistentInstance(); |
| 822 } | 829 } |
| 823 } | 830 } |
| 824 | 831 |
| 825 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 832 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |