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 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) | 101 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) |
102 : created_resource_dispatcher_host_(false), | 102 : created_resource_dispatcher_host_(false), |
103 created_metrics_service_(false), | 103 created_metrics_service_(false), |
104 created_io_thread_(false), | 104 created_io_thread_(false), |
105 created_file_thread_(false), | 105 created_file_thread_(false), |
106 created_db_thread_(false), | 106 created_db_thread_(false), |
107 created_process_launcher_thread_(false), | 107 created_process_launcher_thread_(false), |
108 created_cache_thread_(false), | 108 created_cache_thread_(false), |
109 created_gpu_thread_(false), | 109 created_gpu_thread_(false), |
110 created_watchdog_thread_(false), | 110 created_watchdog_thread_(false), |
| 111 #if defined(OS_CHROMEOS) |
| 112 created_webproxy_thread_(false), |
| 113 #endif |
111 created_profile_manager_(false), | 114 created_profile_manager_(false), |
112 created_local_state_(false), | 115 created_local_state_(false), |
113 created_icon_manager_(false), | 116 created_icon_manager_(false), |
114 created_devtools_manager_(false), | 117 created_devtools_manager_(false), |
115 created_sidebar_manager_(false), | 118 created_sidebar_manager_(false), |
116 created_browser_policy_connector_(false), | 119 created_browser_policy_connector_(false), |
117 created_notification_ui_manager_(false), | 120 created_notification_ui_manager_(false), |
118 created_safe_browsing_detection_service_(false), | 121 created_safe_browsing_detection_service_(false), |
119 module_ref_count_(0), | 122 module_ref_count_(0), |
120 did_start_(false), | 123 did_start_(false), |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Cancel pending requests and prevent new requests. | 203 // Cancel pending requests and prevent new requests. |
201 resource_dispatcher_host()->Shutdown(); | 204 resource_dispatcher_host()->Shutdown(); |
202 } | 205 } |
203 | 206 |
204 ExtensionTabIdMap::GetInstance()->Shutdown(); | 207 ExtensionTabIdMap::GetInstance()->Shutdown(); |
205 | 208 |
206 // The policy providers managed by |browser_policy_connector_| need to shut | 209 // The policy providers managed by |browser_policy_connector_| need to shut |
207 // down while the IO and FILE threads are still alive. | 210 // down while the IO and FILE threads are still alive. |
208 browser_policy_connector_.reset(); | 211 browser_policy_connector_.reset(); |
209 | 212 |
| 213 #if defined(OS_CHROMEOS) |
| 214 webproxy_thread_.reset(); |
| 215 #endif |
| 216 |
210 #if defined(USE_X11) | 217 #if defined(USE_X11) |
211 // The IO thread must outlive the BACKGROUND_X11 thread. | 218 // The IO thread must outlive the BACKGROUND_X11 thread. |
212 background_x11_thread_.reset(); | 219 background_x11_thread_.reset(); |
213 #endif | 220 #endif |
214 | 221 |
215 // Wait for removing plugin data to finish before shutting down the IO thread. | 222 // Wait for removing plugin data to finish before shutting down the IO thread. |
216 WaitForPluginDataRemoverToFinish(); | 223 WaitForPluginDataRemoverToFinish(); |
217 | 224 |
218 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to | 225 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to |
219 // delete related objects on the GPU thread. This must be done before | 226 // delete related objects on the GPU thread. This must be done before |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 #endif | 429 #endif |
423 | 430 |
424 WatchDogThread* BrowserProcessImpl::watchdog_thread() { | 431 WatchDogThread* BrowserProcessImpl::watchdog_thread() { |
425 DCHECK(CalledOnValidThread()); | 432 DCHECK(CalledOnValidThread()); |
426 if (!created_watchdog_thread_) | 433 if (!created_watchdog_thread_) |
427 CreateWatchdogThread(); | 434 CreateWatchdogThread(); |
428 DCHECK(watchdog_thread_.get() != NULL); | 435 DCHECK(watchdog_thread_.get() != NULL); |
429 return watchdog_thread_.get(); | 436 return watchdog_thread_.get(); |
430 } | 437 } |
431 | 438 |
| 439 #if defined(OS_CHROMEOS) |
| 440 base::Thread* BrowserProcessImpl::webproxy_thread() { |
| 441 DCHECK(CalledOnValidThread()); |
| 442 if (!created_webproxy_thread_) |
| 443 CreateWebproxyThread(); |
| 444 DCHECK(webproxy_thread_.get() != NULL); |
| 445 return webproxy_thread_.get(); |
| 446 } |
| 447 #endif |
| 448 |
432 ProfileManager* BrowserProcessImpl::profile_manager() { | 449 ProfileManager* BrowserProcessImpl::profile_manager() { |
433 DCHECK(CalledOnValidThread()); | 450 DCHECK(CalledOnValidThread()); |
434 if (!created_profile_manager_) | 451 if (!created_profile_manager_) |
435 CreateProfileManager(); | 452 CreateProfileManager(); |
436 return profile_manager_.get(); | 453 return profile_manager_.get(); |
437 } | 454 } |
438 | 455 |
439 PrefService* BrowserProcessImpl::local_state() { | 456 PrefService* BrowserProcessImpl::local_state() { |
440 DCHECK(CalledOnValidThread()); | 457 DCHECK(CalledOnValidThread()); |
441 if (!created_local_state_) | 458 if (!created_local_state_) |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 // messages in such a way that Google Update can communicate back to us. | 757 // messages in such a way that Google Update can communicate back to us. |
741 options.message_loop_type = MessageLoop::TYPE_UI; | 758 options.message_loop_type = MessageLoop::TYPE_UI; |
742 #else | 759 #else |
743 options.message_loop_type = MessageLoop::TYPE_IO; | 760 options.message_loop_type = MessageLoop::TYPE_IO; |
744 #endif | 761 #endif |
745 if (!thread->StartWithOptions(options)) | 762 if (!thread->StartWithOptions(options)) |
746 return; | 763 return; |
747 file_thread_.swap(thread); | 764 file_thread_.swap(thread); |
748 } | 765 } |
749 | 766 |
| 767 #if defined(OS_CHROMEOS) |
| 768 void BrowserProcessImpl::CreateWebproxyThread() { |
| 769 DCHECK(!created_webproxy_thread_ && webproxy_thread_.get() == NULL); |
| 770 created_webproxy_thread_ = true; |
| 771 |
| 772 scoped_ptr<base::Thread> thread( |
| 773 new BrowserProcessSubThread(BrowserThread::WEBPROXY)); |
| 774 base::Thread::Options options; |
| 775 options.message_loop_type = MessageLoop::TYPE_IO; |
| 776 if (!thread->StartWithOptions(options)) |
| 777 return; |
| 778 webproxy_thread_.swap(thread); |
| 779 } |
| 780 #endif |
| 781 |
750 void BrowserProcessImpl::CreateDBThread() { | 782 void BrowserProcessImpl::CreateDBThread() { |
751 DCHECK(!created_db_thread_ && db_thread_.get() == NULL); | 783 DCHECK(!created_db_thread_ && db_thread_.get() == NULL); |
752 created_db_thread_ = true; | 784 created_db_thread_ = true; |
753 | 785 |
754 scoped_ptr<base::Thread> thread( | 786 scoped_ptr<base::Thread> thread( |
755 new BrowserProcessSubThread(BrowserThread::DB)); | 787 new BrowserProcessSubThread(BrowserThread::DB)); |
756 if (!thread->Start()) | 788 if (!thread->Start()) |
757 return; | 789 return; |
758 db_thread_.swap(thread); | 790 db_thread_.swap(thread); |
759 } | 791 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 } | 1075 } |
1044 | 1076 |
1045 void BrowserProcessImpl::OnAutoupdateTimer() { | 1077 void BrowserProcessImpl::OnAutoupdateTimer() { |
1046 if (CanAutorestartForUpdate()) { | 1078 if (CanAutorestartForUpdate()) { |
1047 DLOG(WARNING) << "Detected update. Restarting browser."; | 1079 DLOG(WARNING) << "Detected update. Restarting browser."; |
1048 RestartPersistentInstance(); | 1080 RestartPersistentInstance(); |
1049 } | 1081 } |
1050 } | 1082 } |
1051 | 1083 |
1052 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1084 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |