| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 void BrowserProcessImpl::PostStopThread(BrowserThread::ID thread_id) { | 284 void BrowserProcessImpl::PostStopThread(BrowserThread::ID thread_id) { |
| 285 switch (thread_id) { | 285 switch (thread_id) { |
| 286 case BrowserThread::FILE: | 286 case BrowserThread::FILE: |
| 287 // With the file_thread_ flushed, we can release any icon resources. | 287 // With the file_thread_ flushed, we can release any icon resources. |
| 288 icon_manager_.reset(); | 288 icon_manager_.reset(); |
| 289 break; | 289 break; |
| 290 case BrowserThread::IO: | 290 case BrowserThread::IO: |
| 291 // Reset associated state right after actual thread is stopped, | 291 // Reset associated state right after actual thread is stopped, |
| 292 // as io_thread_.global_ cleanup happens in CleanUp on the IO | 292 // as io_thread_.global_ cleanup happens in CleanUp on the IO |
| 293 // thread, i.e. as the thread exits its message loop. | 293 // thread, i.e. as the thread exits its message loop. |
| 294 // |
| 295 // This is important also because in various places, the |
| 296 // IOThread object being NULL is considered synonymous with the |
| 297 // IO thread having stopped. |
| 294 io_thread_.reset(); | 298 io_thread_.reset(); |
| 295 break; | 299 break; |
| 296 default: | 300 default: |
| 297 break; | 301 break; |
| 298 } | 302 } |
| 299 } | 303 } |
| 300 | 304 |
| 301 #if defined(OS_WIN) | 305 #if defined(OS_WIN) |
| 302 // Send a QuitTask to the given MessageLoop when the (file) thread has processed | 306 // Send a QuitTask to the given MessageLoop when the (file) thread has processed |
| 303 // our (other) recent requests (to save preferences). | 307 // our (other) recent requests (to save preferences). |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 CreateMetricsService(); | 411 CreateMetricsService(); |
| 408 return metrics_service_.get(); | 412 return metrics_service_.get(); |
| 409 } | 413 } |
| 410 | 414 |
| 411 IOThread* BrowserProcessImpl::io_thread() { | 415 IOThread* BrowserProcessImpl::io_thread() { |
| 412 DCHECK(CalledOnValidThread()); | 416 DCHECK(CalledOnValidThread()); |
| 413 DCHECK(io_thread_.get()); | 417 DCHECK(io_thread_.get()); |
| 414 return io_thread_.get(); | 418 return io_thread_.get(); |
| 415 } | 419 } |
| 416 | 420 |
| 417 base::Thread* BrowserProcessImpl::file_thread() { | |
| 418 DCHECK(CalledOnValidThread()); | |
| 419 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::FILE); | |
| 420 } | |
| 421 | |
| 422 base::Thread* BrowserProcessImpl::db_thread() { | |
| 423 DCHECK(CalledOnValidThread()); | |
| 424 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::DB); | |
| 425 } | |
| 426 | |
| 427 WatchDogThread* BrowserProcessImpl::watchdog_thread() { | 421 WatchDogThread* BrowserProcessImpl::watchdog_thread() { |
| 428 DCHECK(CalledOnValidThread()); | 422 DCHECK(CalledOnValidThread()); |
| 429 if (!created_watchdog_thread_) | 423 if (!created_watchdog_thread_) |
| 430 CreateWatchdogThread(); | 424 CreateWatchdogThread(); |
| 431 DCHECK(watchdog_thread_.get() != NULL); | 425 DCHECK(watchdog_thread_.get() != NULL); |
| 432 return watchdog_thread_.get(); | 426 return watchdog_thread_.get(); |
| 433 } | 427 } |
| 434 | 428 |
| 435 #if defined(OS_CHROMEOS) | |
| 436 base::Thread* BrowserProcessImpl::web_socket_proxy_thread() { | |
| 437 DCHECK(CalledOnValidThread()); | |
| 438 return BrowserThread::UnsafeGetBrowserThread(BrowserThread::WEB_SOCKET_PROXY); | |
| 439 } | |
| 440 #endif | |
| 441 | |
| 442 ProfileManager* BrowserProcessImpl::profile_manager() { | 429 ProfileManager* BrowserProcessImpl::profile_manager() { |
| 443 DCHECK(CalledOnValidThread()); | 430 DCHECK(CalledOnValidThread()); |
| 444 if (!created_profile_manager_) | 431 if (!created_profile_manager_) |
| 445 CreateProfileManager(); | 432 CreateProfileManager(); |
| 446 return profile_manager_.get(); | 433 return profile_manager_.get(); |
| 447 } | 434 } |
| 448 | 435 |
| 449 PrefService* BrowserProcessImpl::local_state() { | 436 PrefService* BrowserProcessImpl::local_state() { |
| 450 DCHECK(CalledOnValidThread()); | 437 DCHECK(CalledOnValidThread()); |
| 451 if (!created_local_state_) | 438 if (!created_local_state_) |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 } | 977 } |
| 991 | 978 |
| 992 void BrowserProcessImpl::OnAutoupdateTimer() { | 979 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 993 if (CanAutorestartForUpdate()) { | 980 if (CanAutorestartForUpdate()) { |
| 994 DLOG(WARNING) << "Detected update. Restarting browser."; | 981 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 995 RestartBackgroundInstance(); | 982 RestartBackgroundInstance(); |
| 996 } | 983 } |
| 997 } | 984 } |
| 998 | 985 |
| 999 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 986 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |