| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 unsigned int BrowserProcessImpl::ReleaseModule() { | 324 unsigned int BrowserProcessImpl::ReleaseModule() { |
| 325 DCHECK(CalledOnValidThread()); | 325 DCHECK(CalledOnValidThread()); |
| 326 DCHECK_NE(0u, module_ref_count_); | 326 DCHECK_NE(0u, module_ref_count_); |
| 327 module_ref_count_--; | 327 module_ref_count_--; |
| 328 if (0 == module_ref_count_) { | 328 if (0 == module_ref_count_) { |
| 329 CHECK(MessageLoop::current()->is_running()); | 329 CHECK(MessageLoop::current()->is_running()); |
| 330 // Allow UI and IO threads to do blocking IO on shutdown, since we do a lot | 330 // Allow UI and IO threads to do blocking IO on shutdown, since we do a lot |
| 331 // of it on shutdown for valid reasons. | 331 // of it on shutdown for valid reasons. |
| 332 base::ThreadRestrictions::SetIOAllowed(true); | 332 base::ThreadRestrictions::SetIOAllowed(true); |
| 333 CHECK(!BrowserList::GetLastActive()); | 333 CHECK(!BrowserList::GetLastActive()); |
| 334 io_thread()->message_loop()->PostTask( | 334 BrowserThread::PostTask( |
| 335 BrowserThread::IO, |
| 335 FROM_HERE, | 336 FROM_HERE, |
| 336 base::IgnoreReturn<bool>( | 337 base::IgnoreReturn<bool>( |
| 337 base::Bind(&base::ThreadRestrictions::SetIOAllowed, true))); | 338 base::Bind(&base::ThreadRestrictions::SetIOAllowed, true))); |
| 338 | 339 |
| 339 #if defined(OS_MACOSX) | 340 #if defined(OS_MACOSX) |
| 340 MessageLoop::current()->PostTask( | 341 MessageLoop::current()->PostTask( |
| 341 FROM_HERE, | 342 FROM_HERE, |
| 342 base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); | 343 base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); |
| 343 #endif | 344 #endif |
| 344 MessageLoop::current()->Quit(); | 345 MessageLoop::current()->Quit(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 base::Thread* BrowserProcessImpl::file_thread() { | 417 base::Thread* BrowserProcessImpl::file_thread() { |
| 417 DCHECK(CalledOnValidThread()); | 418 DCHECK(CalledOnValidThread()); |
| 418 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::FILE); | 419 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::FILE); |
| 419 } | 420 } |
| 420 | 421 |
| 421 base::Thread* BrowserProcessImpl::db_thread() { | 422 base::Thread* BrowserProcessImpl::db_thread() { |
| 422 DCHECK(CalledOnValidThread()); | 423 DCHECK(CalledOnValidThread()); |
| 423 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::DB); | 424 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::DB); |
| 424 } | 425 } |
| 425 | 426 |
| 426 base::Thread* BrowserProcessImpl::process_launcher_thread() { | |
| 427 DCHECK(CalledOnValidThread()); | |
| 428 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::PROCESS_LAUNCHER); | |
| 429 } | |
| 430 | |
| 431 base::Thread* BrowserProcessImpl::cache_thread() { | |
| 432 DCHECK(CalledOnValidThread()); | |
| 433 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::CACHE); | |
| 434 } | |
| 435 | |
| 436 WatchDogThread* BrowserProcessImpl::watchdog_thread() { | 427 WatchDogThread* BrowserProcessImpl::watchdog_thread() { |
| 437 DCHECK(CalledOnValidThread()); | 428 DCHECK(CalledOnValidThread()); |
| 438 if (!created_watchdog_thread_) | 429 if (!created_watchdog_thread_) |
| 439 CreateWatchdogThread(); | 430 CreateWatchdogThread(); |
| 440 DCHECK(watchdog_thread_.get() != NULL); | 431 DCHECK(watchdog_thread_.get() != NULL); |
| 441 return watchdog_thread_.get(); | 432 return watchdog_thread_.get(); |
| 442 } | 433 } |
| 443 | 434 |
| 444 #if defined(OS_CHROMEOS) | 435 #if defined(OS_CHROMEOS) |
| 445 base::Thread* BrowserProcessImpl::web_socket_proxy_thread() { | 436 base::Thread* BrowserProcessImpl::web_socket_proxy_thread() { |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 } | 997 } |
| 1007 | 998 |
| 1008 void BrowserProcessImpl::OnAutoupdateTimer() { | 999 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1009 if (CanAutorestartForUpdate()) { | 1000 if (CanAutorestartForUpdate()) { |
| 1010 DLOG(WARNING) << "Detected update. Restarting browser."; | 1001 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1011 RestartBackgroundInstance(); | 1002 RestartBackgroundInstance(); |
| 1012 } | 1003 } |
| 1013 } | 1004 } |
| 1014 | 1005 |
| 1015 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1006 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |