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