Chromium Code Reviews| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 #endif | 130 #endif |
| 131 | 131 |
| 132 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) | 132 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) |
| 133 : created_resource_dispatcher_host_(false), | 133 : created_resource_dispatcher_host_(false), |
| 134 created_metrics_service_(false), | 134 created_metrics_service_(false), |
| 135 created_io_thread_(false), | 135 created_io_thread_(false), |
| 136 created_file_thread_(false), | 136 created_file_thread_(false), |
| 137 created_db_thread_(false), | 137 created_db_thread_(false), |
| 138 created_process_launcher_thread_(false), | 138 created_process_launcher_thread_(false), |
| 139 created_cache_thread_(false), | 139 created_cache_thread_(false), |
| 140 created_appcache_thread_(false), | |
| 140 created_watchdog_thread_(false), | 141 created_watchdog_thread_(false), |
| 141 #if defined(OS_CHROMEOS) | 142 #if defined(OS_CHROMEOS) |
| 142 created_web_socket_proxy_thread_(false), | 143 created_web_socket_proxy_thread_(false), |
| 143 #endif | 144 #endif |
| 144 created_profile_manager_(false), | 145 created_profile_manager_(false), |
| 145 created_local_state_(false), | 146 created_local_state_(false), |
| 146 created_icon_manager_(false), | 147 created_icon_manager_(false), |
| 147 created_devtools_manager_(false), | 148 created_devtools_manager_(false), |
| 148 created_sidebar_manager_(false), | 149 created_sidebar_manager_(false), |
| 149 created_browser_policy_connector_(false), | 150 created_browser_policy_connector_(false), |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 | 254 |
| 254 // Stop the watchdog thread before stopping other threads. | 255 // Stop the watchdog thread before stopping other threads. |
| 255 watchdog_thread_.reset(); | 256 watchdog_thread_.reset(); |
| 256 | 257 |
| 257 // Need to stop io_thread_ before resource_dispatcher_host_, since | 258 // Need to stop io_thread_ before resource_dispatcher_host_, since |
| 258 // io_thread_ may still deref ResourceDispatcherHost and handle resource | 259 // io_thread_ may still deref ResourceDispatcherHost and handle resource |
| 259 // request before going away. | 260 // request before going away. |
| 260 io_thread_.reset(); | 261 io_thread_.reset(); |
| 261 | 262 |
| 262 // The IO thread was the only user of this thread. | 263 // The IO thread was the only user of this thread. |
| 264 appcache_thread_.reset(); | |
| 265 | |
| 266 // The IO thread was the only user of this thread. | |
| 263 cache_thread_.reset(); | 267 cache_thread_.reset(); |
| 264 | 268 |
| 265 // Stop the process launcher thread after the IO thread, in case the IO thread | 269 // Stop the process launcher thread after the IO thread, in case the IO thread |
| 266 // posted a task to terminate a process on the process launcher thread. | 270 // posted a task to terminate a process on the process launcher thread. |
| 267 process_launcher_thread_.reset(); | 271 process_launcher_thread_.reset(); |
| 268 | 272 |
| 269 // Clean up state that lives on the file_thread_ before it goes away. | 273 // Clean up state that lives on the file_thread_ before it goes away. |
| 270 if (resource_dispatcher_host_.get()) { | 274 if (resource_dispatcher_host_.get()) { |
| 271 resource_dispatcher_host()->download_file_manager()->Shutdown(); | 275 resource_dispatcher_host()->download_file_manager()->Shutdown(); |
| 272 resource_dispatcher_host()->save_file_manager()->Shutdown(); | 276 resource_dispatcher_host()->save_file_manager()->Shutdown(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 return process_launcher_thread_.get(); | 435 return process_launcher_thread_.get(); |
| 432 } | 436 } |
| 433 | 437 |
| 434 base::Thread* BrowserProcessImpl::cache_thread() { | 438 base::Thread* BrowserProcessImpl::cache_thread() { |
| 435 DCHECK(CalledOnValidThread()); | 439 DCHECK(CalledOnValidThread()); |
| 436 if (!created_cache_thread_) | 440 if (!created_cache_thread_) |
| 437 CreateCacheThread(); | 441 CreateCacheThread(); |
| 438 return cache_thread_.get(); | 442 return cache_thread_.get(); |
| 439 } | 443 } |
| 440 | 444 |
| 445 base::Thread* BrowserProcessImpl::appcache_thread() { | |
| 446 DCHECK(CalledOnValidThread()); | |
| 447 if (!created_appcache_thread_) | |
| 448 CreateAppCacheThread(); | |
| 449 return appcache_thread_.get(); | |
| 450 } | |
| 451 | |
| 452 | |
| 441 WatchDogThread* BrowserProcessImpl::watchdog_thread() { | 453 WatchDogThread* BrowserProcessImpl::watchdog_thread() { |
| 442 DCHECK(CalledOnValidThread()); | 454 DCHECK(CalledOnValidThread()); |
| 443 if (!created_watchdog_thread_) | 455 if (!created_watchdog_thread_) |
| 444 CreateWatchdogThread(); | 456 CreateWatchdogThread(); |
| 445 DCHECK(watchdog_thread_.get() != NULL); | 457 DCHECK(watchdog_thread_.get() != NULL); |
| 446 return watchdog_thread_.get(); | 458 return watchdog_thread_.get(); |
| 447 } | 459 } |
| 448 | 460 |
| 449 #if defined(OS_CHROMEOS) | 461 #if defined(OS_CHROMEOS) |
| 450 base::Thread* BrowserProcessImpl::web_socket_proxy_thread() { | 462 base::Thread* BrowserProcessImpl::web_socket_proxy_thread() { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 | 906 |
| 895 scoped_ptr<base::Thread> thread( | 907 scoped_ptr<base::Thread> thread( |
| 896 new BrowserThread(BrowserThread::CACHE)); | 908 new BrowserThread(BrowserThread::CACHE)); |
| 897 base::Thread::Options options; | 909 base::Thread::Options options; |
| 898 options.message_loop_type = MessageLoop::TYPE_IO; | 910 options.message_loop_type = MessageLoop::TYPE_IO; |
| 899 if (!thread->StartWithOptions(options)) | 911 if (!thread->StartWithOptions(options)) |
| 900 return; | 912 return; |
| 901 cache_thread_.swap(thread); | 913 cache_thread_.swap(thread); |
| 902 } | 914 } |
| 903 | 915 |
| 916 void BrowserProcessImpl::CreateAppCacheThread() { | |
| 917 DCHECK(!created_appcache_thread_ && !appcache_thread_.get()); | |
| 918 created_appcache_thread_ = true; | |
| 919 | |
| 920 scoped_ptr<base::Thread> thread( | |
| 921 new BrowserThread(BrowserThread::APPCACHE)); | |
|
rvargas (doing something else)
2011/10/21 19:46:17
Just double checking that you don't intend to use
michaeln
2011/10/21 19:52:12
definitely not right now, i don't anticipate doing
| |
| 922 if (!thread->Start()) | |
| 923 return; | |
| 924 appcache_thread_.swap(thread); | |
| 925 } | |
| 926 | |
| 904 void BrowserProcessImpl::CreateWatchdogThread() { | 927 void BrowserProcessImpl::CreateWatchdogThread() { |
| 905 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); | 928 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); |
| 906 created_watchdog_thread_ = true; | 929 created_watchdog_thread_ = true; |
| 907 | 930 |
| 908 scoped_ptr<WatchDogThread> thread(new WatchDogThread()); | 931 scoped_ptr<WatchDogThread> thread(new WatchDogThread()); |
| 909 if (!thread->Start()) | 932 if (!thread->Start()) |
| 910 return; | 933 return; |
| 911 watchdog_thread_.swap(thread); | 934 watchdog_thread_.swap(thread); |
| 912 } | 935 } |
| 913 | 936 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1156 } | 1179 } |
| 1157 | 1180 |
| 1158 void BrowserProcessImpl::OnAutoupdateTimer() { | 1181 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1159 if (CanAutorestartForUpdate()) { | 1182 if (CanAutorestartForUpdate()) { |
| 1160 DLOG(WARNING) << "Detected update. Restarting browser."; | 1183 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1161 RestartPersistentInstance(); | 1184 RestartPersistentInstance(); |
| 1162 } | 1185 } |
| 1163 } | 1186 } |
| 1164 | 1187 |
| 1165 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1188 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |